Allows you to edit the cells in a DataGrid
'Assembly: System.Data.dll
'Assembly: System.Windows.Forms.dll
'Assembly: System.Windows.Forms.DataGrid.dll
'Namespace: Microsoft.VisualBasic
'Namespace: System.Windows.Forms
'Namespace: System.Data
'Namespace: System
'Dim datagrid AS DataGrid
'Dim button AS Button
Private Sub dataGrid_CurrentCellChanged(ByVal sender As Object, ByVal e As EventArgs) _
Handles datagrid.CurrentCellChanged
Dim currentCell As DataGridCell
Dim currentCellData As String
' Get the current cell.
currentCell = datagrid.CurrentCell
' Get the current cell's data.
currentCellData = CStr(datagrid(currentCell.RowNumber, currentCell.ColumnNumber))
' interact with currentCellData
End Sub
Private Sub buttonSetCurrentCell_Click(ByVal o As Object, ByVal e As EventArgs) _
Handles button.Click
Dim currentCell As DataGridCell
Dim currentCellData As String
' Get the text to put into the current cell.
currentCellData = "currentCellData"
' Get the current cell.
currentCell = datagrid.CurrentCell
' Set the current cell's data.
datagrid(currentCell.RowNumber, currentCell.ColumnNumber) = currentCellData
End Sub