Hi I am building an order entry form using Windows Forms in VB.NET.
Ihave created a test/dummy application to trial and test on, and have a DataGridView with 2 columns ("Item Code", and "Description")
The "Item Code (Column1)" column is a data-bound combobox (however for my example I have just included some string values).
The second column "Description (Column2)" will retrieve the item description, based on the value selected in column1.
The below code works prefectly for what I want to achieve, however....the values are only added once focus has been lost from the row NOT when the user selects the item.
Private Sub DataGridView1_RowValidating(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellCancelEventArgs) Handles DataGridView1.RowValidating
Dim row As DataGridViewRow = DataGridView1.Rows(e.RowIndex)
If Not row.Cells("Column1").Value Is Nothing Then
'First Item Selected
If row.Cells("Column1").Value.ToString = "ITM01" Then
row.Cells("Column2").Value = "Item Description 01"
e.Cancel = False
End If
'Second Item Selected
If row.Cells("Column1").Value.ToString = "ITM02" Then
row.Cells("Column2").Value = "Item Description 02"
e.Cancel = False
End If
End If
End Sub<br/><br/><br/>
As I mentioned above, I wish to get the item description when the user selectsthe item codefrom the comboBox. Any ideas on how to achieve this?
Thanks in advanced