windows forms datagrid

I am binding data to a datagrid using windows forms. I want to make sure that the user selects one record out of the displayed data in datagrid, otherwise i should throw a validation error saying one record should be selected on submit button event. Also i want to grab the record value the user in the datagrid in my code.

Thanks,
sandeep
LVL 3
cognos79Asked:
Who is Participating?
 
Bob LearnedCommented:
Dim value As String = dataGrid(row, column).ToString()

Bob
0
 
Bob LearnedCommented:
Dim count As Integer
For row As Integer = 0 To table.Rows.Count - 1
  If dataGrid1.IsSelected(row) Then
     count +=1
  End If
Next row

Bob
0
 
cognos79Author Commented:
learnedone...thanks it works.
i am also displaying only one column in the datagrid. how can i get the value of the selected row in the datagrid..
0
 
cognos79Author Commented:
got it working.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.