0
TabControl1.SelectedTab.Controls(4).Text =”Test”

Control and Tab Pages created in runtime. (No of Tab pages depend on user input)

How to handle this control without control Number. ?
(Is any way to handle with Control Name)

2
Contributors
10
Replies
25
Views
4 Years
Discussion Span
Last Post by pc20912
0

If you pay attention to Intellisense when you're typing your code, you'll be able to see that one of the overloaded options is using the name of the control as an index of the control collection

0

Thanks for Reply, I tried to catch it, still not....
Please show me...

0

Sir, Error display while running,

Null Reference Exception was unhandled
Object reference not set to an instance of an object.

In my project,
Tab Pages and controls created(Add) in run time.

0

Sir,
I inserted Text Boxes and Labels as controls to Tab Pages.
I want to change Label.text and Textboxes Text

0

Sir, Sorry Iam Not understand it, I'am just start to learn Vb.Net.

I show what I already did,

Declare Controls,
Dim NewMTXT As TextBox
Dim NewMLBL as Label
Dim NewBTN as Button

Before I creating Tab Pages I did like this,
NewMTXT = New TextBox
NewMLBL = New Label
NewBTN = New Button

after I add its,
newPage.Controls.Add(NewMTXT)
newPage.Controls.Add(NewMLBL)

AddHandler NewBTN.Click, AddressOf My1
newPage.Controls.Add(NewBTN)

with "My1" sub,
I want to change "NewMTXT" text, when click "NewBTN"

Sir, Please explain me how to do this,

0
NewMTXT = New TextBox
NewMTXT.Name = "NewMTXT1"
NewMLBL = New Label
NewMLBL.Name = "NewMLBL1"
NewBTN = New Button

Private Sub My1(sender As Object, e As EventArgs)
    Me.Controls("NewMTXT1").Text = "MyString"
End Sub
0

Sir,

Thank you very much for your Instructions,
You solved my problem.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.