I am new to vb
Flexgrid
Header 01 .... 31
Values .........
I am entering the values at run time in flexgrid cell, if i click tab button, the focus will move to next cell on the same row.
Code for Ascii
Private Sub flexgrid_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 48 To 57
flexgrid.Text = flexgrid.Text & Chr(KeyAscii)
Case 46 'Dot
flexgrid.Text = flexgrid.Text & Chr(KeyAscii)
Case 8
If Len(flexgrid.Text) > 0 Then
flexgrid.Text = Left(flexgrid.Text, (Len(flexgrid.Text) - 1))
End If
Case Else
KeyAscii = 0
Beep
End Select
End Sub
How to do this.
And also how to change the particular cell background color. Code
For i = 1 To flexgrid.Rows - 1
flexgrid.TextMatrix(i, 33) = vbred 'It's giving value like '255'
flexgrid.TextMatrix(i, 33) = .CellBackColor = vbred 'It's giving value 'False'
Next i
Any ideas & suggestion...?
To move the selected column use the KeyDown (or KeyUp if you prefer) event and place your code there.
Private Sub MSFlexGrid1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = Asc(vbTab) Then
If MSFlexGrid1.Col < MSFlexGrid1.Cols - 1 Then
MSFlexGrid1.Col = MSFlexGrid1.Col + 1
End If
End If
End Sub
To change the cell background color first set the cell, then set the CellBackColor.
flexgrid.Row = i
flexgrid.Col = 33
flexgrid.CellBackColor = vbRed