We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Knowing if a row has been selected in a DataGrid.

Thread ID:

Created:

Updated:

Platform:

Replies:

1499 Nov 5,2002 03:42 PM UTC Mar 18,2003 11:02 AM UTC WinForms 2
loading
Tags: FAQ
Thomas
Asked On November 5, 2002 03:42 PM UTC

Hi, I have a DataGrid (Windows Forms), which I have programmed such that whole rows are selected. When a user presses a button, I want to check whether an item in the DataGrid has been selected. Is there a DataGrid property that indicates whether a row has been selected in the DataGrid. For example, in C++ (MFC) the list view control has a property that has a value of -1 when no row has been selected in the control. If a row is selected, it returns the row number. Is there something similar for the DataGrid? I noticed that the method CurrentRowIndex returns the currently selected row or the last selected row when nothing is highlighted in the DataGrid. If there isn't something equivalent, what would be the best way of figuring it out, without having to iterate through the entire DataGrid? Thanks.

Thomas
Replied On November 6, 2002 12:29 PM UTC

Don't worry about this one...I figured it out. > Hi, > > I have a DataGrid (Windows Forms), which I have programmed such that whole rows are selected. When a user presses a button, I want to check whether an item in the DataGrid has been selected. > > Is there a DataGrid property that indicates whether a row has been selected in the DataGrid. > For example, in C++ (MFC) the list view control has a property that has a value of -1 when no row has been selected in the control. If a row is selected, it returns the row number. > Is there something similar for the DataGrid? > I noticed that the method CurrentRowIndex returns the currently selected row or the last selected row when nothing is highlighted in the DataGrid. > > If there isn't something equivalent, what would be the best way of figuring it out, without having to iterate through the entire DataGrid? > Thanks.

Jim
Replied On March 18, 2003 11:02 AM UTC

So, what was your solution? I'd be really interested to know. Thanks, Jim

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;