Solved

windows forms datagrid

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

830 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