From this thread I kind of get the idea of how to fill textboxes with records from a row by clicking on the datagridview but I have not quite got it right in practice.
My Code:
On the first dbl Click it sets it to 0 every time and on the second dbl Click I get this error: This causes two bindings in the collection to bind to the same property. Parameter name: bindingVB Code:
Private Sub frmEdit_Load( _ ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Load Dim da As SqlDataAdapter Dim ds As DataSet = New DataSet da = New SqlDataAdapter("Select * " & _ "From vShowEditData Where StoreID = '" & _ StoreID & "' Order by CategoryCode, ItemCode", Con) da.TableMappings.Add("Table", "EditInv") Try da.Fill(ds) ds.Tables("EditInv").DefaultView.AllowNew = False dgvEditData.DataSource = ds.Tables("EditInv") myBindingSource.DataSource = ds.Tables("EditInv") Catch ex As Exception MessageBox.Show( _ ex.Message & vbNewLine & _ ex.Source, "Data Error", _ MessageBoxButtons.OK) Finally da.Dispose() ds.Dispose() End Try End Sub Private Sub dgvEditData_RowHeaderMouseDoubleClick( _ ByVal sender As Object, _ ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) _ Handles dgvEditData.RowHeaderMouseDoubleClick tbStart.DataBindings.Add("Text", myBindingSource, "OnHandQ") End Sub




Reply With Quote