How to prevent cursor skips from one cell to another in VB.net datagrid?
Hi all,
I have designed a datagrid in VB.net to show,modify,add and delete records from a table. Now I want to validate user's input before the cursor skips to next cell or next row. If validation fails, the cursor should stay where it was. I tried table's columnChanging/RowChanging event. But I couldn't find how to prevent the cursor from jumping to next cell or row. Could anyone help?
thx.
DataGrid Data validation and messages
Hi There
I have a similar problem
I have datagrids that I am using, that has not been specified with databinding from the datagrid properties.
See the code below.....
My pain is that I need to generate messages for data entry errors, for
1. Compulsory Columns
2. Range Checks
Can anyone help PLEASE? :eek2:
VB Code:
Private Sub CreateGrid()
Dim tsSeats As New DataGridTableStyle
tsSeats.MappingName = "Seats"
Dim dtSeats As DataTable = DsSeats1.Tables("Seats")
Dim i As Integer
While i < dtSeats.Columns.Count
Dim txtCol As New DataGridTextBoxColumn
With txtCol
.MappingName = dtSeats.Columns(i).ColumnName
.HeaderText = dtSeats.Columns(i).ColumnName
If i = 0 Then
.Width = 70
.ReadOnly = True
Else
.Width = 100
End If
tsSeats.GridColumnStyles.Add(txtCol)
End With
i = i + 1
End While
dgSeats.TableStyles.Clear()
dgSeats.TableStyles.Add(tsSeats)
dgSeats.DataSource = dtSeats
End Sub