Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
First textbox in form not accepting input properly
I have a form containing three textboxes with the right adjust property
set. The first textbox is initialized with the number 12. The cursor is blinking behind the number 12, which is not highlighted like it should be. When I type in the number 25 the textbox shows 1225 instead of overwriting the number 12 to get 25. There is no problem when I type in the remaining textboxes where the existing number is highlighted and is overwritten by the number typed in. I’ve tried making the tabindex 0 which didn’t work. I also put a dummy textbox or commandbutton with an tabindex of 0 in front of the leading textbox. This worked but its dumb having to have to tab it before entering data in the desired textbox. How can I fix this? What is happening? Is this a bug? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
First textbox in form not accepting input properly
What is happening is that when you set the text box value (I assume i UserForm_Activate or UserForm_Initialize), it is acting as if the valu was typed in (since it kind of was). To have it highlighted, you mus highlight it: Private Sub UserForm_Initialize() TextBox1.Value = 12 TextBox1.SelStart = 0 TextBox1.SelLength = Len(TextBox1.Text) End Sub -- kkkni ----------------------------------------------------------------------- kkknie's Profile: http://www.excelforum.com/member.php...nfo&userid=754 View this thread: http://www.excelforum.com/showthread.php?threadid=26739 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
First textbox in form not accepting input properly
I would guess this is by design. After all, if you have
initialized the value to 12, there must be a good reason for it. Put it another way, if you wanted to change the value as soon as the form opened, then why would you initialize the text box to 12? The best I could do is this: Private Sub UserForm_Initialize() Me.TextBox1.Value = 12 Me.TextBox1.SelStart = 0 End Sub Geof. -----Original Message----- I have a form containing three textboxes with the right adjust property set. The first textbox is initialized with the number 12. The cursor is blinking behind the number 12, which is not highlighted like it should be. When I type in the number 25 the textbox shows 1225 instead of overwriting the number 12 to get 25. There is no problem when I type in the remaining textboxes where the existing number is highlighted and is overwritten by the number typed in. I've tried making the tabindex 0 which didn't work. I also put a dummy textbox or commandbutton with an tabindex of 0 in front of the leading textbox. This worked but its dumb having to have to tab it before entering data in the desired textbox. How can I fix this? What is happening? Is this a bug? *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
First textbox in form not accepting input properly
Way to go k!
-----Original Message----- What is happening is that when you set the text box value (I assume in UserForm_Activate or UserForm_Initialize), it is acting as if the value was typed in (since it kind of was). To have it highlighted, you must highlight it: Private Sub UserForm_Initialize() TextBox1.Value = 12 TextBox1.SelStart = 0 TextBox1.SelLength = Len(TextBox1.Text) End Sub K -- kkknie ---------------------------------------------------------- -------------- kkknie's Profile: http://www.excelforum.com/member.php? action=getinfo&userid=7543 View this thread: http://www.excelforum.com/showthread...hreadid=267397 . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
First textbox in form not accepting input properly
That did it. I'll admit I don't see why one has to go through those
extra steps but they work so lots of thanks. *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
input in number form is being multiplied by 1000 when i input. | Excel Discussion (Misc queries) | |||
How can I have an input form to add a random no. to each input entry? | Excel Discussion (Misc queries) | |||
validation of input in textbox | Excel Programming | |||
Limit input in a textbox | Excel Programming | |||
Textbox does not print properly | Excel Programming |