I have VS .Net and am working with VB .Net. I have a DataGrid on my form where I selected a pre-created style for it and set it to read-only. What I want to do is have it only allow for a row to be selected, not individual cells. I do not want the user to be able to select a cell, or multiple rows, just one row at a time. I also need the ability to get DoubleClick to work like it works with the FlexGrid control back in VB6 (i.e. you can double-click on any cell and it will register a double-click event, with the DataGrid you have to double-click on the far left side of the control for it to register). The code that I'm using to populate the DataGrid is below:
Dim Adapter As OleDbDataAdapter
Dim ds As DataSet
Dim Sql As String
'Perform the search
Sql = "SELECT * FROM Customers WHERE FirstName LIKE '" & txtFirstName.Text & "%' AND LastName LIKE '" & txtLastName.Text & "%'"
Adapter = New OleDbDataAdapter(Sql, cn)
ds = New DataSet()
'Load the results into the datagrid
Catch ex As Exception
'Don't worry about a blank dataset
This works fine to load the results in, but right now the best I can do toward what I want is to set the DataGrid ("grdResults") to ReadOnly and then have a button on the form that checks "grdResults.CurrentRowIndex()" to determine what has been selected. Double-clicking doesn't work, and I can't get it to select the entire row when a cell is clicked on.
I am up for suggestions on other controls to use (as long as they come with VS .Net Enterprise Edition). I would prefer to use a .Net Framework component over a COM control. Any help is appreciated.