Please Help With toolstrip
Posted: Mon Aug 13, 2012 8:27 pm
Hello I am trying to make a tool strip clear all controls bare three so with some help came up with this
Code: Select all
But It is not working everything loads but when I press the button for it it just brings up the message box and then excutes the finally command Try
For Each tsi As ToolStripItem In ToolStrip1.Items
If TypeOf tsi Is ToolStripButton And tsi.Text = "2" Or tsi.Text = "1" Or tsi.Name = "ToolStripSeparator3" Then
Else
ToolStrip1.Items.Remove(tsi)
End If
Next
For Each tsi As ToolStripItem In ToolStrip1.Items
If TypeOf tsi Is ToolStripButton And tsi.Text = "1" Or "2" Then
Else
ToolStrip1.Items.Remove(tsi)
End If
Next
Catch ex As Exception
MsgBox(ex.ToString)
Finally
Faves.Items.Add(ComboBox1.Text)
Dim btnTop As Integer = 0
For i As Integer = 0 To Faves.Items.Count - 1
Dim btn As New ToolStripButton
btn.Text = Faves.Items(i).ToString()
btn.ForeColor = Color.White
btn.BackColor = Color.FromArgb(60, 60, 60)
btn.Tag = i
AddHandler btn.Click, AddressOf btnclicked
ToolStrip1.Items.Add(btn)
btnTop += 30
Next
End Try