Solved

windows forms datagrid

Posted on 2006-06-29
4
182 Views
Last Modified: 2010-04-23
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
0
Comment
Question by:cognos79
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17010353
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
 
LVL 3

Author Comment

by:cognos79
ID: 17010669
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
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 17010695
Dim value As String = dataGrid(row, column).ToString()

Bob
0
 
LVL 3

Author Comment

by:cognos79
ID: 17010990
got it working.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question