Click here to Skip to main content
15,878,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
txtName.Text = ((DataRowView)dgvPersonInformation.SelectedItem).Row["PersonName"].ToString();
txtname.Text is Null And erro message is InvalidCastException
Posted

1 solution

VB
Private Sub DataGrid1_SelectionChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGrid1.SelectionChanged
       If Me.DataGrid1.SelectedRows.Count > 0 Then
           Me.TextBox1.Text = Me.DataGrid1.SelectedRows(0).Cells(0).Value
       End If
   End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900