URGENT- REPLACE TEXT IN A TEXTBOX


Posted by Randy Parris on November 07, 2001 9:00 AM

Greetings,

Hope I can get some help as soon as possible.
I have a 2 textboxes sitting on a lable to make up a premium textbox1 is for dollars and textbox2 is cents. I have 0.00 in the textbox, so that when the userform is used dollars and cents would be entered. My problem is when I run the userform I am able to change textbox1 but when I get to textbox2 the cursor skips to the back of the 00. Can anyone help with any additional code so that after the dollars are punched the two zeros would be highlighted so that cents can be punched. Check out the code. Thanks a lot.

private sub premium1_Keydown(ByVal keycode as msforms.returninteger, byval shift as integer)
if keycode = 110 then
keycode = 0
premium 2.setfocus
end if
end sub

Posted by Luke on November 07, 2001 9:18 AM

I have used this code in one of my programs to take an income (inkomen in dutch). The routine checks each entered character and only allows digits 0-9 and a comma or dot to be entered. Maybe it can help???

Private Sub inkomendisplayp_keypress(ByVal kasc As MSForms.ReturnInteger)
If kasc < Asc("0") Or kasc > Asc("9") Then
If kasc = 44 Or kasc = 46 And Not inkomendisplayp Like "*,*" Then
kasc = 44
ElseIf kasc = 45 And inkomendisplayp <> "" Then
inkomendisplayp = inkomendisplayp * -1
kasc = 0
Else
kasc = 0
End If
Else
If Abs(CCur(inkomendisplayp & Chr(kasc)) * 100) > Abs(Fix(CCur(inkomendisplayp & Chr(kasc)) * 100)) Then
kasc = 0
ElseIf Abs(CCur(inkomendisplayp & Chr(kasc)) > 999999999.99) Then
kasc = 0
End If
End If
End Sub

Luke



Posted by Randy Parris on November 09, 2001 4:33 AM


Thanks