Targeting a textbox within a TabPage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • robertybob
    New Member
    • Feb 2013
    • 116

    Targeting a textbox within a TabPage

    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

    Code:
    Dim tabcontrol As String = "Tab" & a.ToString
    Dim textcontrol As String = "Text" & b.ToString
    DirectCast(myTabs.Controls(textcontrol), TextBox).Text = "Hello"
    However nothing seems to target it correctly. Not 'Me.', 'myTabs.', 'Me.myTabs.'...

    Any ideas? Thanks!
  • robertybob
    New Member
    • Feb 2013
    • 116

    #2
    FInally seem to have solved this with the reference

    DirectCast(Me.m yTabs.TabPages( tabcontrol).Con trols(textcontr ol), textbox).Text

    Comment

    Working...