Results 1 to 7 of 7

Thread: Data Grid selet row

  1. #1

    Thread Starter
    Hyperactive Member Mosabama's Avatar
    Join Date
    Aug 2004
    Location
    Mars
    Posts
    306

    Data Grid selet row

    Hello ...

    when I click on the datagrid, a cell in the datagrid will be selected ...
    but I want the whole row to be selected and not a cell ...
    is there a style or something that should be changed ...

    Muchas gracias ....
    My software never has bugs. It just develops random features.
    I RATE, YOU RATE!!!

  2. #2

    Thread Starter
    Hyperactive Member Mosabama's Avatar
    Join Date
    Aug 2004
    Location
    Mars
    Posts
    306

    Re: Data Grid selet row

    any body has any idea about what I am talking about ??

    I think its easy but I can't find it ...
    My software never has bugs. It just develops random features.
    I RATE, YOU RATE!!!

  3. #3
    Hyperactive Member
    Join Date
    Nov 2001
    Location
    Albany, NY
    Posts
    489

    Re: Data Grid selet row

    There should be a Select method on the datagrid that you pass a rowindex to

  4. #4

    Thread Starter
    Hyperactive Member Mosabama's Avatar
    Join Date
    Aug 2004
    Location
    Mars
    Posts
    306

    Re: Data Grid selet row

    do you have any sample code for that ???

    Cause what I am talking about is selecting all the row ... Not a cell ... I dont want any cell to be selected ...
    selecting a cell means selecting the whole row where the cell is...
    My software never has bugs. It just develops random features.
    I RATE, YOU RATE!!!

  5. #5
    Hyperactive Member
    Join Date
    Nov 2001
    Location
    Albany, NY
    Posts
    489

    Re: Data Grid selet row

    VB Code:
    1. myDataGrid.Select(0) 'Select Row 0 (first row)

    msdn link:
    ms-help://MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfsystemwindowsformsdatagridclassselecttopic.htm

  6. #6
    Frenzied Member mar_zim's Avatar
    Join Date
    Feb 2004
    Location
    Toledo Cebu City.
    Posts
    1,416

    Re: Data Grid selet row

    Quote Originally Posted by Mosabama
    do you have any sample code for that ???

    Cause what I am talking about is selecting all the row ... Not a cell ... I dont want any cell to be selected ...
    selecting a cell means selecting the whole row where the cell is...
    here's what i've got.
    dunno if this would be the efficient one.
    VB Code:
    1. 'cn is a connection
    2.     Dim da As New SqlDataAdapter("select * from orders", cn)
    3.     Dim dt As New DataTable()
    4.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    5.         da.Fill(dt)
    6.         DataGrid1.DataSource = dt
    7.     End Sub
    8.  
    9.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    10.         Dim i As Integer
    11.         Dim s As String
    12.         For i = 0 To dt.Columns.Count - 1
    13.             s &= " " & DataGrid1.Item(DataGrid1.CurrentCell.RowNumber, i.ToString)
    14.         Next
    15.         MsgBox(s)
    16.     End Sub
    hope that helps.

  7. #7
    INXSIVE Bruce Fox's Avatar
    Join Date
    Sep 2001
    Location
    Melbourne, Australia
    Posts
    7,429

    Re: Data Grid selet row

    Is the RowHeader hidden? ie. so you have no selection tags on the left hand edge of the DataGrid.





    Bruce.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width