-
June 7th, 2011, 09:15 AM
#1
designating tabpage based on name. "toString" not possible.
I am trying to figure out how to change the tab selected in a tabcontrol and tell the program which tab to select based on its' name. The problem is that the tab would be added programmatically in runtime. The error report says
"Value of type 'String' cannot be converted to 'System.Windows.Forms.TabPage'. "
What can I do?
Code:
Private Sub CatBtn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CatBtn1.Click
TC2.SelectedTab = Me.Text
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
y = y + 24
Dim NTP As New TabPage()
TC2.Controls.Add(NTP)
NTP.Width = 75
Dim NCB As New CatBtn()
NCB.Location = New Point(0, y)
Panel1.Controls.Add(NCB)
Dim NLV As New ListView()
NLV.Dock = DockStyle.Fill
NLV.Items.Add("item 1")
NLV.Items.Add("item 2")
Label2.Text = y
NTP.Text = TextBox2.Text
NCB.Text = TextBox2.Text
TextBox2.Text = ""
End Sub
BTW, I failed to mention this in my last post. I know I went on a long hiatus. I was designing someone's website with flash cs5.
-
June 7th, 2011, 09:36 AM
#2
Re: designating tabpage based on name. "toString" not possible.
-
June 9th, 2011, 09:10 AM
#3
Re: designating tabpage based on name. "toString" not possible.
Code:
TC2.SelectedTab = TC2.TabPages(Me.Text)
-
June 10th, 2011, 04:16 AM
#4
Re: designating tabpage based on name. "toString" not possible.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|