textBox1.Text = TabControl1.SelectedTab.Tag;
That code doesnt work for some reason, could someone please tell what the working code is
textBox1.Text = TabControl1.SelectedTab.Tag;
That code doesnt work for some reason, could someone please tell what the working code is
Tabcontrol.tag
DanMoran
.text and .tag are 2 completely different things
the .text is the name of the tabpage, the .tag is somewhere to store information,
Im using the .tag to store a line of information which i would like 2 access during runtime, is this not possible
Dungeonhawk
Then try this
textBox1.Text = TabControl1.SelectedTab.Tag as string;
textBox1.Text = (string)TabControl1.SelectedTab.Tag;
MikeB41
You certainly should be able to use the Tag as you say. What exactly is going wrong Is the .Tag field null when it shouldn't be How do you assign to the .Tag field
Or are you getting a compile error You need to cast .Tag to string, since .Tag is an object.
Richard L. Irwin
textBox1.Text = (String)TabControl1.SelectedTab.Tag;
// Or
textBox1.Text = TabControl1.SelectedTab.Tag as String;
// Or
textBox1.Text = TabControl1.SelectedTab.Tag.ToString();
Cesar Dela Paz
What you want is SelectedTab.Text, I think.