468,103 Members | 1,264 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,103 developers. It's quick & easy.

Targeting a textbox within a TabPage

116 64KB
Hi,

I've tried all combinations and can't get this to work at all so any help to understand 'controls' is appreciated.

I have a Form
On the Form is a TabControl named myTabs
The TabControl has a number of tabs named sequentially
The first Tab is named Tab1
On Tab1 I have a number of textboxes named sequentially
The first box is named Text1

My problem is how to target Text1 directly?

My current efforts to target any given box on any given tab are based on code such as

Expand|Select|Wrap|Line Numbers
  1. Dim tabcontrol As String = "Tab" & a.ToString
  2. Dim textcontrol As String = "Text" & b.ToString
  3. DirectCast(myTabs.Controls(textcontrol), TextBox).Text = "Hello"
  4.  
However nothing seems to target it correctly. Not 'Me.', 'myTabs.', 'Me.myTabs.'...

Any ideas? Thanks!
Dec 28 '14 #1

✓ answered by robertybob

FInally seem to have solved this with the reference

DirectCast(Me.myTabs.TabPages(tabcontrol).Controls (textcontrol), textbox).Text

1 2461
robertybob
116 64KB
FInally seem to have solved this with the reference

DirectCast(Me.myTabs.TabPages(tabcontrol).Controls (textcontrol), textbox).Text
Dec 28 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by Helmut Wagensonner | last post: by
2 posts views Thread by Jerrad | last post: by
1 post views Thread by VB Programmer | last post: by
6 posts views Thread by rn5a | last post: by
3 posts views Thread by =?Utf-8?B?QW5kcmV3IEhheWVz?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.