Programatically select datagrid row

  • Thread starter Thread starter developer
  • Start date Start date
D

developer

I have a Windows form that contains a datagrid populated
with a table in my database.

When i load my form i want a particular row in my datagrid
to be selected.

How can i do that

Thanks
 
Hi,

Thanks for posting in this group.
First, in form load event, you should bind the datatable in the dataset to
the datagrid, then you should use DataGrid.Expand(-1) to expand the
datagrid.
Finally, you can use DataGrid.Select(rownumber) method to select a certain
row.

If you have anything unclear, please feel free to tell me.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "developer" <[email protected]>
| Sender: "developer" <[email protected]>
| Subject: Programatically select datagrid row
| Date: Wed, 29 Oct 2003 18:01:54 -0800
| Lines: 9
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOeicqTKgOiZQX/S+C2exWB0oexTA==
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:195261
| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I have a Windows form that contains a datagrid populated
| with a table in my database.
|
| When i load my form i want a particular row in my datagrid
| to be selected.
|
| How can i do that
|
| Thanks
|
 
Back
Top