By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,985 Members | 1,712 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,985 IT Pros & Developers. It's quick & easy.

Targeting a textbox within a TabPage

100+
P: 116
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

Share this Question
Share on Google+
1 Reply


100+
P: 116
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.