Dissable Tabbing into a textbox

bmruze

Member
Joined
Jan 20, 2008
Messages
6
Location
Michigan, USA
Programming Experience
1-3
I have created an array and I'm trying to keep a user from tabbing into a textbox.

VB.NET:
CarNumberArray = New TextBoxArray(Me.pnlCarList, 34)
        Lap1Array = New TextBoxArray(Me.pnlCarList, 141)
        Lap2Array = New TextBoxArray(Me.pnlCarList, 287)
        FastestLapArray = New TextBoxArray(Me.pnlCarList, 427)

In this picture it shows what is created when the program is run. You can see the last 3 columns are readonly and from the code below you can see that I have it set to not accept tabbing. The code works on the first row but not on anything after that. Is there something that I'm doing wrong or could be suggested?
Carimage.jpg


VB.NET:
FastestLapArray(0).TabStop = False
        FastestLapArray(0).AcceptsTab = False
        FastestLapArray(0).ReadOnly = True
 
You're only referring to the element at index zero so of course it only affects the first element. If you want to affect every element then you have to set those properties (other than AcceptsTab, which is pointless) for the elements at all indexes. If you want to refer to every item in a list then you would use a For or For Each loop.
 
Cor.. disabling tab (something that anyone who is slightly proficient with a computer knows can change the focused textbox) - that would be kinda annoying huh?

As a quick tip: If youre doing something to your UI to make it not behave in a way that most other windows apps do behave.. dont do it
 
Cor.. disabling tab (something that anyone who is slightly proficient with a computer knows can change the focused textbox) - that would be kinda annoying huh?

As a quick tip: If youre doing something to your UI to make it not behave in a way that most other windows apps do behave.. dont do it
I think you may have misinterpreted the question cjard. The OP is just asking how to prevent tabbing into those read-only TextBoxes specifically. It's quite normal for read-only TextBoxes to not be a tab stop because if you can't input then you normally won't need to visit. The only reason to visit is to copy text, in which case you can click.

If you want to prevent focus altogether then that's another story, but that's not what I get from the question.
 
Back
Top