Re: Is MSFlexGrid editable?
There is calculate event for the MSFlexGrid, but you can, programmatically, make it editable. Is this what you are after?
Re: Is MSFlexGrid editable?
Quote:
Originally Posted by Hack
There is calculate event for the MSFlexGrid, but you can, programmatically, make it editable. Is this what you are after?
Basically wat i m after is instead of writing in textboxes which will programatically enter the data in the grid. Can i directly make entries into the grid??????? :(
Re: Is MSFlexGrid editable?
Quote:
Originally Posted by kaushiks
Basically wat i m after is instead of writing in textboxes which will programatically enter the data in the grid. Can i directly make entries into the grid??????? :(
Yes. Try this.
VB Code:
Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
With MSFlexGrid1
Select Case KeyAscii
Case 8: 'backspace
If .Text <> "" Then .Text = _
Left$(.Text, (Len(.Text) - 1))
Case 13: 'enter key
Select Case .Col
Case Is < (.Cols - 1):
SendKeys "{right}"
Case (.Cols - 1):
If (.Row + 1) = .Rows Then
.Rows = .Rows + 1
End If
SendKeys "{home}" + "{down}"
End Select
Case Else
.Text = .Text + Chr$(KeyAscii)
'write your own keyascii Validations under
'commented lines
Select Case .Col
Case 0, 1, 2:
'if (your condition(s)) then
'accept only charectors
'Else
' keyascii=0
'End If
Case Else
End Select
End Select
End With
End Sub
Re: Is MSFlexGrid editable?
Quote:
Originally Posted by Hack
Yes. Try this.
VB Code:
Private Sub MSFlexGrid1_KeyPress(KeyAscii As Integer)
With MSFlexGrid1
Select Case KeyAscii
Case 8: 'backspace
If .Text <> "" Then .Text = _
Left$(.Text, (Len(.Text) - 1))
Case 13: 'enter key
Select Case .Col
Case Is < (.Cols - 1):
SendKeys "{right}"
Case (.Cols - 1):
If (.Row + 1) = .Rows Then
.Rows = .Rows + 1
End If
SendKeys "{home}" + "{down}"
End Select
Case Else
.Text = .Text + Chr$(KeyAscii)
'write your own keyascii Validations under
'commented lines
Select Case .Col
Case 0, 1, 2:
'if (your condition(s)) then
'accept only charectors
'Else
' keyascii=0
'End If
Case Else
End Select
End Select
End With
End Sub
Thanx man i think this might work :)
Re: Is MSFlexGrid editable?
Quote:
Originally Posted by kaushiks
Thanx man i think this might work :)
I honestly don't know how long I've had that piece of code, but it has been quite a while and I've used it many, many times myself. :)