By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,813 Members | 2,269 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,813 IT Pros & Developers. It's quick & easy.

Validate msflexgrid's cells

P: 44
Just another msflexgrid's topic..

does anyone know how to validate the cell from msflexgrid?

for example i want to validate the column(3) if it's not numeric (after editing) then it would disable moving to other cells until it completely fulfill the condition.

Here's my code
Expand|Select|Wrap|Line Numbers
  1. Private Sub MSFlexGrid1_LeaveCell()
  2. For i = 1 To MSFlexGrid1.Rows - 2
  3. If IsNumeric(MSFlexGrid1.TextMatrix(i, 3)) Then
  4.     MSFlexGrid1.CellBackColor = &H80000005 
  5. Else
  6.     MsgBox "data invalid"
  7. End If
  8. Next
  9. End Sub
It works but it wont disable the movement when i typed data that is not numeric =(
Jan 10 '08 #1
Share this Question
Share on Google+
3 Replies

Expert 100+
P: 487
Did you tried it in Grid_KeyUp event ?
Jan 10 '08 #2

P: 44
Did you tried it in Grid_KeyUp event ?
yup but it wont work though..
Jan 10 '08 #3

Expert 100+
P: 1,445

Writing code in LeaveCell doesnt stop moving to the next cell..
All you can do is Just before Saving, Do a Through Checking of the Column..

Or else Place TextBox on the Grid Cell To Enter Data, and write code in TextBox's Validate event..

Jan 10 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.