Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

text in textbox disappears

Status
Not open for further replies.

technohead

Technical User
Jan 12, 2002
64
0
0
US
Hi,
i have this weird problem.
i have a form for updating customer details so all textboxes are filled in on the form . however when i change say the customer firstname and move to the next textbox the text in the customer firstname textbox disappears. this also happens when i move from the surname box to the address textbox and so on.

can anyone help me! thanks
 
i call the following function to validate text.
is there something here that is causing the error????

Private Sub txtsurname_KeyPress(KeyAscii As Integer)
KeyAscii = CustomKeys(KeyAscii)
End Sub


Public Function CustomKeys(KeyAscii As Integer) As Integer
Select Case KeyAscii
Case 8, 13, 32, 39, 45, 65 To 90, 97 To 122

Case Else
KeyAscii = 0
ans = MsgBox(" You have entered an invalid Character", vbOKOnly, "Invalid Character")
End Select
CustomKeys = KeyAscii
End Function
 
I see nothing that would clear anything else.

But I do see a minor "problem". In KeyPress, KeyAscii is passed as an argument and recieves the return value but in CustomerKeys, KeyAscii, as a parameter, can be changed to zero and then also passed back. It is redundant and could have "side effects" if you ever call CustomerKeys and only want to check the the return value, not have the passed argument changed. A "small thing" I know but so are gnats, chiggers and those other "nosee'ems". Generate Forms/Controls Resizing/Tabbing Class
Compare Code (Text)
Generate Sort Class in VB or VBScript
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top