vb.net Windows Form Tab Key

V

vmuntean

Hello,

I've been trying to find an answer to this for quite some time but I
haven't been able to.

I created a vb.net application which it contains a windows form with
several text boxes. I want the user to be able to press the Tab key to
move from textbox to textbox.

I know that in vb6 by setting the tabstop to True and setting the
TabIndex you could do that easily. But this does not seem to work in
vb.net. I tried playing with key events and such but no luck.

Did they remove the user's ability to Tab through text boxes in vb.net
or am I missing something?

Thank you very much,
Vlad
 
V

vmuntean

look for the TabStop property in the designer.

--Jon

I set the TabStop to True in the designer and checked in the
corresponding code. This is the code for one of the textboxes:

Me.txt_material.AcceptsTab = True
Me.txt_material.Location = New System.Drawing.Point(224, 64)
Me.txt_material.Name = "txt_material"
Me.txt_material.Size = New System.Drawing.Size(64, 20)
Me.txt_material.TabIndex = 3
Me.txt_material.TabStop = True
Me.txt_material.Text = ""

It is still not allowing me to tab between text boxes. Is there
anything that I should change in the above properties, or should I
look somewhere else?

Thank you,
Vlad
 
M

Mark Lincoln

I think AcceptsTab may mean that the textbox accepts Tab characters as
part of the user input. (I'm sure someone will correct me if I'm
wrong.) Try setting AcceptsTab to False and see if you can Tab out of
the textbox.

Mark Lincoln
 
V

vmuntean

I tried that and it did not make a difference. Let me provide all the
information for both the form and the text box:

Form Properties:
AccessibleDescription blank
AccessibleName blank
AccessibleRole blank

Behavior
AllowDrop False
ContextMenu (none)
Enabled True
ImeMode NoControl

Configurations
DynamicProperties blank
(Advanced) blank

Data
databindinigs blank
Tag blank

Design
name frm....
DrawGrid True
GridSize 8,8
Locked False
SnapToGrid True

Focus
CausesValidation True

Misc
AcceptButton none
CancelButton none
KayPreview True
Language default
localizable false
 
V

vmuntean

And textbox properties

AccessibleDescription blank
AccessibleName blank
AccessibleRole blank

Behavior
AcceptsReturn False
AcceptsTab False
AllowDrop False
AutoSize True
CharacterCasing Normal
ContextMenu none
Enabled True
HideSelection True
ImeMode NoControl
Multiline False
PasswordChar blank
ReadOnly False
TabIndex 0, 1, 2, 3 (I changed them in the order I would like them to
tab in)
TabStop True
Visible True
WordWrap True

Configurations
(DynamicProperties) blank

Design
(name) frm...
Locked False
Modifiers Friend

Focus
CausesValidation True

Thank you again,
Vlad
 
F

Family Tree Mike

The only thing I would guess aside from what the others stated, is to ask if
you are handling keydown, keyup or keypress events in the form. You may be
handling the tab there so that the form doesn't use the tab between controls.
In general, the default textbox dragged onto the form will have "AcceptsTab
= false", "TabStop = true" and "TabIndex = N", where N increases in the order
the controls are added.
 
M

Mark Lincoln

I'm too new to vb.net to have a real firm grasp on its
idiosyncrasies. If, as suggested elsewhere, you aren't handling
keypresses yourself somewhere, I'm not sure where to look. For what
it's worth, the few forms I've made so far work flawlessly in terms of
tabbing between controls, so that ability has not been taken away.

I see "CausesValidation True" in your post. Is validation somehow
voiding tab key presses while in a textbox?

Mark Lincoln
 
C

Cor Ligthert[MVP]

What version of VS do you use,

In VS2002, 2003, 2005 and 2008 I only set the tabindex and it does what it
should do for me, going from index to index when the tab key comes up.

Cor
 
V

vmuntean

I just checked, and I am not using any keyup, keydown or keypress
events. I am using VS2003 (but I see the same issue with VS2005). What
I am actually doing is creating a SolidWorks add-in. I wonder if that
is the culprit, since I just created a simple project with a form and
it tabbed between the textboxes just fine !?

I also checked and all the settings are identical for the newly
created form not linked to the add-in and the one I am having problems
with.

Thank you,
Vlad
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top