I have 10 textbox array. I wanted to allow numeric input only so i use this code:
Private Sub txtfield_KeyPress(Index As Integer, KeyAscii As Integer)
If Not Chr(KeyAscii) Like "[0-9]" And KeyAscii <> 8 Then KeyAscii = 0
End Sub
but it gives me compile error : Procedure declaration does not match description of event or procedure having the same name.
please help what to do, thanks.
true anoymous
true anoymous
Allow numbers only
Well I always use
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case Chr(KeyAscii)
Case "0" To "9" 'allow numbers
Case "." 'allows period
Case "-" 'allows minus
Case vbBack 'allows backspace to function to delete
Case Else
KeyAscii = 0
End Select
End Sub
You have a control array because you have an Index.
Keith
www.martin2k.co.uk/forums/
I've been programming with VB for 14 years. Started with VB4 16bit Pro, VB5 Pro, VB6 Pro/Enterprise and now VB3 Pro. But I'm no expert, I'm still learning
Problem Editing Form
i have form1 with Add/Edit command button
when i click add
the textbox control array allows to input on my 10 textbox
the the add button will change to save
when i press save it saves.
the problem is when i edit.
when i press edit i wanted to load again the form with it content
but when i put breakpoints it goes to update immediately.
please help this is the snippets!
If NameEntry = "ME" Then
RetrieveContent
For i = 0 To 11
dbname.Seek_DuplicateRecord NameEntry
With dbname.Seek_DuplicateRecord
If .RecordCount <> 0 Then
dbname.Seek_DuplicateRecord NameEntry
Me.txtfield(i).Enabled = True
End If
.Close
End With
Next i
''''What to put on this line?? I need the form to show with the content and edit it before it update'''
UpdateNameEntry
End If
Post new comment