VB.Net progam the selecting of a row of a DataGridView

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • News.Individual.NET

    VB.Net progam the selecting of a row of a DataGridView

    Hi all,

    I can detect the active row (iRowIndex: see below please) and do whatever I
    want, but I do not seem to be able to set a row to be selected.

    How can I do that in vb.Net?

    Private Sub DataGridView1_M ouseDown(etc... ..

    Dim btnLeft = Windows.Forms.M ouseButtons.Lef t

    If e.Button = btnLeft Then

    Dim hit As DataGridView.Hi tTestInfo = DataGridView1.H itTest(e.X, e.Y)
    If hit.Type = DataGridViewHit TestType.Cell Then
    clickedCell = DataGridView1.R ows(hit.RowInde x).Cells(hit.Co lumnIndex)
    iRowIndex = CInt(hit.RowInd ex)
    etc...


  • Jack Jackson

    #2
    Re: VB.Net progam the selecting of a row of a DataGridView

    On 21 Jul 2008 17:57:43 GMT, "News.Individua l.NET"
    <josephoget@hot mail.co.ukwrote :
    >Hi all,
    >
    >I can detect the active row (iRowIndex: see below please) and do whatever I
    >want, but I do not seem to be able to set a row to be selected.
    >
    >How can I do that in vb.Net?
    >
    >Private Sub DataGridView1_M ouseDown(etc... ..
    >
    >Dim btnLeft = Windows.Forms.M ouseButtons.Lef t
    >
    >If e.Button = btnLeft Then
    >
    > Dim hit As DataGridView.Hi tTestInfo = DataGridView1.H itTest(e.X, e.Y)
    > If hit.Type = DataGridViewHit TestType.Cell Then
    > clickedCell = DataGridView1.R ows(hit.RowInde x).Cells(hit.Co lumnIndex)
    > iRowIndex = CInt(hit.RowInd ex)
    etc...
    >
    Set the Row.Selected property to True.

    Comment

    Working...