I have a dgv with 14 columns.
If i'm in dgv.item(8,0) in edit mode
What code can i use to jump to (12,0) and also enter editmode.
I call it editmode, dont know what the actual term is :o. Its the state where you can enter a value into that cell
Printable View
I have a dgv with 14 columns.
If i'm in dgv.item(8,0) in edit mode
What code can i use to jump to (12,0) and also enter editmode.
I call it editmode, dont know what the actual term is :o. Its the state where you can enter a value into that cell
Datagridview.CurrentCell = Datagridview.Rows(12).Cells(0)
Justin
The code you provided only selects the cell, but doesn't enter "editmode". I still have to click the cell before I can enter any data into that cell.
2nd problem I encountered was this error.
Attachment 78833
Any Ideas?
Why is your code in the CellLeave event handler? Also, this:is more simply done like this:Code:Datagridview.Rows(12).Cells(0)
Code:Datagridview(0, 12)
This is only my test project. In my main project it works like this:
The first column is the important one. After the user selected a value from the DatagridviewComboBoxColumn in column(0) it loads certain data from a table in the database. Then it defaults the values of some of the other columns.
99.99% of the time the values that have been defaulted wont need changing, so my goal is to skip the defaulted columns and jump directly into the important ones. This will make it easier for the user to capture data.
I found a way.
Here it is
vb Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load intActivate = 1 End Sub Dim intActivate As Integer = 0 Dim WishedForCell As DataGridViewCell = Nothing Private Sub dgvPrice_CellValueChanged(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv.CellValueChanged If e.ColumnIndex = 0 Then If intActivate = 1 Then Static RedirectingCell As Boolean = False If Not RedirectingCell Then If e.ColumnIndex = 0 Then RedirectingCell = True WishedForCell = dgv.Item(2, e.RowIndex) End If End If RedirectingCell = False End If End If End Sub Private Sub dgvPrice_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles dgv.KeyUp If WishedForCell IsNot Nothing Then Me.dgv.CurrentCell = WishedForCell WishedForCell = Nothing End If End Sub