Solved

windows forms datagrid

Posted on 2006-06-29
4
179 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Get String split 5 46
VB.NET HttpWebRequest 12 55
More on Time zones in vb 2010 12 37
VB.net/WinForms: adjust Screen Resolution 6 40
Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

929 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now