Solved

windows forms datagrid

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
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: …

760 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

21 Experts available now in Live!

Get 1:1 Help Now