mevets
Member
I have a large case select that I want to simplify. Inside the select I'm creating controls base of which ToolStripButton is checked.
I have been able to simplify many case selects using
I dont have to list all the cases of what kind of control it could be (label, textbox, etc.) cause their all controls and all have the Height method. But, using 'Control' won't work when trying the CheckState method so the second param cannot be Control. I tried
but that was a no go, System.Windows.Forms.ToolStrip cannot be converted to System.Windows.Forms.Control.
Anyone have some helpfl suggestions?
VB.NET:
Select Case strCtrl
Case "Text"
If btnCTRLSText.CheckState = CheckState.Checked Then
newCtrl.Name = "lbl" & intText
newCtrl.Tag = newCtrl.Name
newCtrl.Text = "txt" & intText
newCtrl.Location = New Point(Windows.Forms.Cursor.Position.X, Windows.Forms.Cursor.Position.Y - 21)
Controls.Add(newCtrl)
newCtrl.BringToFront()
AddHandler newCtrl.Click, AddressOf CtrlHandler_Click
intText += 1
btnCTRLSText.CheckState = csUn
End If
Case "Textbox"
[COLOR=Red][B]ETC...[/B][/COLOR]
VB.NET:
CType(sender, Control).Height = 200
VB.NET:
CType(sender, ToolStripButton).CheckState = True
Anyone have some helpfl suggestions?