Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I just search the forum for DataGrid answers, but unfortunately, I found a lot of questions, with few answers.

 

I would just like to know if it's possible to change the selection style of a DatGrid. So that when a user click on a column, the entire row gets selected (like if he had click on the row marker on the left).

 

Of course, my grid doesn't allow new and is not updatable. It would be the master part of a master-detail Form.

 

 

Thanks !

Now go on, boy, and pay attention. Because if you do, someday, you may achieve something that we Simpsons have dreamed about for generations: You may outsmart someone!

--Homer Simpson

  • *Experts*
Posted
I don't think so. The Select method allows you to select the control, or a row, but not a column, and the DataGridColumnStyle class doesn't seem to have any selection functionality.
Posted

Well, I just reread my post and I think it wasn't very clear what I'm trying to do. It's not when a user click on a column, but on a particular cell.

 

What I finally did is use the Select method of the DataGrid. So in the MouseUp event, I call this sub and it works fine.

 

Private Sub mDataGrid_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles mDataGrid.MouseUp
          mDataGrid.Select(mDataGrid.CurrentRowIndex)
   End Sub

Now go on, boy, and pay attention. Because if you do, someday, you may achieve something that we Simpsons have dreamed about for generations: You may outsmart someone!

--Homer Simpson

  • *Experts*
Posted
Oops, sorry. :o I misread, and thought you wanted to be able to click on a column header and select the entire column. Glad you worked it out though.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...