|
-
Jul 9th, 2008, 08:22 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Selecting a Row in a Datagrid
Hi everyone.
I have a datagridview, which is bound to a Microsoft Access table.
To update parts of the database, I have been changing a the data-bound Text property of a text box, and then calling the following three lines:
Code:
BindingSource.EndEdit();
TableAdapter.Update(DataSet);
TableAdapter.Fill(DataSet.Table);
This works fine, but I have encountered a problem: everytime I call these lines, the currently selected row (only one row may be selected at a time) resets to the first item in the table.
I was planning to store the current row's index in a temp variable, call those lines, then call a method which will re-select the row at that index.
I haven't been able to find a method to achieve this. Dioes someone know how can I select a specific row in a data-bound datagridview?
If there's a better way to do this, by all means let me know.
Thanks,
Qu.
EDIT: Sorry, nearly forgot: I'm using MS Access 2003, Visual C# Express and an OleDb Connection.
Last edited by Quasar6; Jul 9th, 2008 at 08:26 PM.
"Why do all my attempts at science end with me getting punched by batman?" xkcd.
| Pong| |
Sorry for not posting more often.
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
|