Mr.White
New member
- Joined
- May 27, 2009
- Messages
- 3
- Programming Experience
- 10+
Hi all,
I have a datagridview which I populate myself (not data bound) where users are able to view the full grid (lets say 60 rows) or the summary view (30 rows).
When I remove every second row for the summary view, some of the cells decide to change value from 0.5 to 1. Even though if I ask Me.Day_DataGridView.CurrentCell.value will return 0.5.
I'm not sure where to start looking as when the summary view code fires, all it is doing is removing every second row (grey text in detailed view).
The code is:
Any data validation when a cell changes ensures is of single type
I have a datagridview which I populate myself (not data bound) where users are able to view the full grid (lets say 60 rows) or the summary view (30 rows).
When I remove every second row for the summary view, some of the cells decide to change value from 0.5 to 1. Even though if I ask Me.Day_DataGridView.CurrentCell.value will return 0.5.
I'm not sure where to start looking as when the summary view code fires, all it is doing is removing every second row (grey text in detailed view).
The code is:
VB.NET:
'Remove alterate rows
For counter As Integer = 1 To (Me.Day_DataGridView.Rows.Count / 2)
Me.Day_DataGridView.Rows.RemoveAt(counter)
Next
Any data validation when a cell changes ensures is of single type
VB.NET:
If Not Me.Day_DataGridView.CurrentCell.Value = Nothing Then
Try
Convert.ToSingle(Me.Day_DataGridView.CurrentCell.Value)
Catch ex As Exception
MsgBox("Invalid entry. " & Me.Day_DataGridView.CurrentCell.Value & " is not a number", MsgBoxStyle.Exclamation + MsgBoxStyle.OkOnly, "Invalid entry")
Me.Day_DataGridView.CurrentCell.Value = ""
Exit Sub
End Try
End If