Post a Reply
|Oldest Newest Rating|
· June 22, 2015
This is something I do all of the time, but would need to see a little more (in code) of what it is you want to do with the DGV. The most common thing I do is use the DGV as a list view of a set of records. What I usually do with this is double click a cell for the record I am interested in to open another form to display the full contents of that record. Is what your doing anything like that? Even if this is not what you are doing with your DGV, it should provide you with enough of an idea about what is required to work with a DGV.
Anyway, here is a code example for this particular usage of a DGV:
The form used:
Double Click event on the DGV. Notice it is not CellContentsDoubleClick, but CellDoubleClick.
Private Sub TblDMDocMasterBaseDataGridView_CellDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles TblDMDocMasterBaseDataGridView.CellDoubleClick
'This routine obtains the record number (primary key) in the table and assigns it to a variable.
'The routine then opens the related record and displays the contents of that record for modification.
glbintRowNum = Me.TblDMDocMasterBaseDataGridView.Rows(e.RowIndex).Cells(0).Value.ToString
glbstrItemNumber = Me.TblDMDocMasterBaseDataGridView.Rows(e.RowIndex).Cells(1).Value.ToString
getDirectory.DMDocFolder(glbintRowNum.ToString) 'This is a sub out in a namespace that is called.
FormSettings.ShowCurrentRecord() 'This is a sub out in a namespace that is called
glbblnOpen = False
Additionally, I can run a query to reduce the size of the list (that is from the combobox in the form), then do the double click event above. The query call goes something like this:
Private Sub btnFilter_Click(sender As Object, e As EventArgs) Handles btnFilter.Click
Dim strDocType As String = cmbDocFilter.Text
If strDocType = "" Then
strDocType += "%"
And the query (in the .xsd file) looks like this:
SELECT intIDNum, strDocType, strItemName, strItemNum, strItemRev FROM tblDMDocMasterBase
WHERE (strDocType LIKE ?)
ORDER BY intIDNum
· May 6, 2015
Not going to write out the code for you but you can research the following
1. Double click event on a data grid to select the info in the rows
2. How to pass the info to a dialog using showdialog
3. Assign the data passed into the dialog to text boxes
This should get you started
One of the first products to provide a graphical environment and a paint metaphor for developing user interfaces.
|Bucky Roberts Administrator|