I am new to programming...
I want to display combobox in a particular column as soon as user starts to enter the text in that column or a cell got selected in that column and it shows the combobox along with its list ,also let to user to type their own values in that cell and display that value as cell text . Currently available comboboxcell doesn't have such faculties . how can i accomplish such task .
any reference to to this ..
thanks in advance ...
Related
Hi I'm hoping someone can help,
I have a Data Grid that has X amount of rows and I have a Text Box at the bottom of my form called 'Notes', I want the user to be able to select a row then enter a note within the Text Box and store this so when the user selects a different row the Text Box will be blank available for notes to be added for the new row. Then if the user selects a row that they have added notes to the Text Box will contain those notes.
I hope that makes sense, any ideas on how to approach this would be really appreciated.
Thanks,
Ryan
Thanks to GuidoG I have solved this, just in case anyone else has the same issue what I did was add a data binding to the grid then set the parameters. "Text" is just the property name, MyDataTable is the data source for my grid and "Notes" is the column name.
MyGrid.DataBindings.Add(new Binding("Text", MyDataTable, "Notes"));
There is problem with combo box values when I double-click on row of data grid view the values from the row passes to text boxes correctly but with combobox there is problem the value is not same in combobox as in data gridview row let me show you in picture.
Used code
For Textbox:
ar.txtcity.Text = this.dataGridView1.CurrentRow.Cells[5].Value.ToString();
For Combobox:
combobox ar.txtcombo.Text = this.dataGridView1.CurrentRow.Cells[6].Value.ToString();
Try this one.
ar.txtcombo.SelectedIndex = ar.txtcombo.FindString(
this.dataGridView1.CurrentRow.Cells[6].Value.ToString());
I think it will help :)
int class= int.Parse(row.Cells[6].Value.ToString());
NameOfYourComboBox.SelectedValue = class;
if the value is not in the database, you can use this;
NameOfYourComboBox.Text = row.Cells[6].Value.ToString();
I have tried this many times and it has worked fine for me with WinForms
hi everyone i'm a new coder here , i'm coding for a datagridview and have to check a row of data in the datagridview , but the problem is the datagridview must be enabled , and the selected cell will be automaticly on the first cell and the first row , if i use this code in the cells , not row , it shows an error , can someone help me to make an anti error if someone use this code when the selected item is cells and not row
if (dataGridView1.SelectedRows.Count < 0==true)
{
MessageBox.Show("Pick the data first!");
}
When i Clicked Update Which Have The Code Above
it Shows This Error
But when i Selected the Full Row and Clicked The Update Button , it Works Normally and No error
I'm not 100% sure what it is you are asking. Are you trying to make the user select full rows in your datagridview instead of individual cells? If that is the case, you'll want to set the SelectionMode property to "FullRowSelect" for your datagridview.
So my guess is that SelectionMode of your dataGridView1 is not set to FullRowSelect or RowHeaderSelect - thus you have no selected rows and dataGridView1.SelectedRows collection is always empty - that is why dataGridView1.SelectedRows[0] throws ArgumentOutOfRangeException.
Changing your dataGridView1.SelectionMode to one of the above according to desired logic should solve your problem.
Iam new to Silverlight. I have a Data Grid with few Text box Template columns . I have bound the grid to a list so that changes in the text box are reflected in the data source entity .
User would type the data in the text box and in the "onleave" event of the text box template column, and I would save the data typed.
I find that data is getting reflected in the enitity. But I cannot use the dataGrid.SelecedItem or dataGrid.SelecedIndex property of the datagrid as user would have seleced a different row after leaving typing data in one row.
My doubt is , how can we find the index of the current row he has edited inside the onleave event of the text box template column ?
Under dataGrid_RowBound(...) event
use e.RowIndex where e is the parameter ( of type EventArgs class)
Instard of OnLeave event you can use the row edit ended event for where you can get e.Row the edited row object . which can be used to save the entity.
In the search form by display button records are displayed from database. but i wnt to
change the header text of data grid column like member_id as memberID.
how can i do it?
as i m trying datagridview.column[1].headerText="memberID" it shows error of indexes of collection so what code i will use to change the header text?
try grid.Columns[0].HeaderText = "memberID". Your column indices may be running out of bound.