Programatically select datagrid row

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • developer

    #1

    Programatically select datagrid row

    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
  • Jeffrey Tan[MSFT]

    #2
    RE: Programatically select datagrid row


    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" <developer@soge scom.net>
    | Sender: "developer" <developer@soge scom.net>
    | Subject: Programatically select datagrid row
    | Date: Wed, 29 Oct 2003 18:01:54 -0800
    | Lines: 9
    | Message-ID: <0dfa01c39e89$c a935ff0$a001280 a@phx.gbl>
    | 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.publi c.dotnet.langua ges.csharp
    | Path: cpmsftngxa06.ph x.gbl
    | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.langua ges.csharp:1952 61
    | NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
    | X-Tomcat-NG: microsoft.publi c.dotnet.langua ges.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
    |

    Comment

    Working...