Currently I am working on VB.Net 3.5 Win Forms.
I have few queries about datagridview, I believe your expertise will help me to overcome this.
1) I have DataGridViewComboBoxCell and DataGridViewTextBoxCellinserted into the the datagridview1, which in turn bounded with the datable,
Here I want to update/edit the value of the datagridviewtextboxcell manually(by user). What I observe is, for each charecter insert/update,
it calls the "DataGridView1_CurrentCellDirtyStateChanged" event, due to which I am facing few problems as below,
- Unable to process the user enterred string/value
- Each time(for each charecter enterred) I have rebind the gridview with datatable and do all processing like coloring and binding above mentioned cells.
- For each charecter insert/edit, gridview get refreshed and show the top part of gridview. If the user updating, cell value in the last row, it is very time consuming, bcz user has to do scrolldown to see that.
please find implement event framework as below, I hope you will make out, how to resove the issue,
Private Sub DataGridView1_CurrentCellDirtyStateChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.CurrentCellDirtyStateChanged
If DataGridView1.IsCurrentCellDirty Then
If TypeOf DataGridView1.CurrentCell Is DataGridViewComboBoxCell Then
' Perform some operation
ElseIf TypeOf DataGridView1.CurrentCell Is DataGridViewTextBoxCell Then
' Perform string manipulation operation, so have to wait till use finished entering text
Could you please let me know, how to make sure that, we wait till user moves to another cell, and once user is done with the particular cell,
how to manipulate the string.
2) Gridview resizing dynamically : I have to display different number of columns for different logic, like sometime I have to display 2 columns, and sometime I have to display 3 columns.
While displaying 3 columns, user can update the 2(Normal gridviewcell)column in the each row and 3rd(added datagridviewtextboxcell) column as in above scenario can be edited.
Question1: How to resise the gridview and the form, to achieve the professionalism.
Question2: Avoid firing DataGridView1_CurrentCellDirtyStateChanged event, while updating the value in the 2nd column.
Thanks a for you help in advance,