LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 28
Default Tab Stop Broken

I have a problem with Tab Stop.

I have 5 textboxes which must be used in order.

UserForm1 starts with Textbox1, Textbox2 Enabled=True and Textbox3 thru
Textbox5 Enabled=False

After a tab from Textbox1 to Textbox2 the code sets Enabled=False for
Textbox1 and Enabled=True for Textbox3 and the cursor should now be in
Textbox2.

This does not work, the cursor skips the entire list of textboxes one by
one as if Tabstop has been turned off.

However, if I choose not to set Enabled=False for the current textbox it
works.

For other reasons not explained here I need to use Textbox_Exit for each
Textbox. I stopped an earlier problem by disabling events when running
the Enabled=False.

Bottom Line, what is wrong with the code? Why isn't it tab stopping?
_______________________________

Dim bDisableEvents As Boolean 'needed to trap enabled = true
_______________________________

Private Sub UserForm_Initialize()
'user must use textboxes in order
'3 textboxes swicthed off with this
TextBox3.Enabled = False 'switch off textbox3
TextBox4.Enabled = False 'switch off textbox3
TextBox5.Enabled = False 'switch off textbox3
End Sub
_______________________________

Private Sub TextBox1_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If bDisableEvents Then Exit Sub
ntl (1)
End Sub
_______________________________

Private Sub TextBox2_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If bDisableEvents Then Exit Sub
ntl (2)
End Sub
_______________________________

Private Sub TextBox3_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If bDisableEvents Then Exit Sub
ntl (3)
End Sub
_______________________________

Private Sub TextBox4_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If bDisableEvents Then Exit Sub
ntl (4)
End Sub
_______________________________

Private Sub TextBox5_Exit(ByVal Cancel As MSForms.ReturnBoolean)
If bDisableEvents Then Exit Sub
ntl (5)
End Sub
_______________________________

Private Sub ntl(bnum As Integer)

'This disables the current textbox

With UserForm1("textbox" & bnum)
bDisableEvents = True
.Enabled = False 'offending code
bDisableEvents = False
End With

'This enables the text box two after current

Dim bbbnum As Integer
bbbnum = bnum + 2

If bbbnum < 6 Then
With UserForm1("textbox" & bbbnum)
.Enabled = True
End With
End If

End Sub
_______________________________

Note:
If I comment out the offending code it works except for the fact that
the Textboxes that should be Enabled=False are still Enabled = True.

If anyone can help me I will be grateful. If you want to see it in
action create a userform with 5 textboxes. Change the offending code to
"comment" and it will tab, remove comment and it will skip textboxes.

Why?

Garry Jones
Sweden
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with Broken Links charles banks Excel Discussion (Misc queries) 5 March 16th 06 03:55 PM
i think its broken littlemcl Excel Discussion (Misc queries) 1 October 7th 05 01:29 PM
Broken Links David Excel Discussion (Misc queries) 3 July 1st 05 02:19 AM
How do I stop other circles in other cells to stop selecting? stauff Excel Worksheet Functions 2 October 29th 04 09:02 PM
How do I stop other circles in other boxes to stop selecting? stauff Excel Worksheet Functions 1 October 28th 04 10:27 PM


All times are GMT +1. The time now is 09:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"