|
-
Aug 28th, 2007, 03:08 PM
#1
Thread Starter
Hyperactive Member
[2005] datagridview select index 0 on click
on button click how do i set the selected index of the data grid to the first record? tnxxxx
also..
how do i set it so that when i click a specific row on a datagrid it would then be selected by the codes?
coz i have a grid and to delete records from it i need to click on a row
Last edited by aerialz666; Aug 28th, 2007 at 03:15 PM.
-
Aug 28th, 2007, 05:56 PM
#2
Re: [2005] datagridview select index 0 on click
Firstly, I would ask that you stop using the term "datagrid" if you're using a DataGridView. The DataGrid is a different control so you cannot use the two names interchangeably. If you do then it's only a matter of time until someone provides advice for a DataGrid that is irrelevant for a DataGridView.
As to your first question, if your grid is bound then you should be using a BindingSource. In that case you simply set the Position property of the BindingSource to 0. That makes the first item the Current item and will thus select it in any bound controls.
Your second question I don't understand at all. When you click on a row in the grid it is selected, so why would you need code to do it?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|