
July 30th, 2012, 03:44 PM
|
 |
Contributing User
|
|
Join Date: Jan 2006
Posts: 122

Time spent in forums: 1 Day 13 h 57 m 38 sec
Reputation Power: 8
|
|
|
Creating control and handler at runtime Problem!!!
So i created a control at runtime and added the event handler
my isusse arises when the runtime combobox selected item is changed it looks for the selected item in combobox6 and not .Name = "actioncombo-" & num
how can i make it so the resulting selected item it from .Name = "actioncombo-" & num
Code:
With action2combo1
.Name = "actioncombo-" & num
.Left = 60
.Top = InnerStepContainer.Height - 45
.Width = 165
.Items.Add("Navigate to a url")
.Items.Add("Gather page details")
.Items.Add("Fill text field")
.Items.Add("Check a checkbox")
.Items.Add("Click radio button")
.Items.Add("Fill combo box")
.Items.Add("Click a image")
.Items.Add("Select list box item")
.Items.Add("Click a button")
.Items.Add("Repeat all steps every")
.Items.Add("End Navigation")
.Text = "Choose One"
.BringToFront()
.Height = 24
This is what i need but also wont work--->> AddHandler "actioncombo-" & num & .SelectedIndexChanged, AddressOf ComboBox6_SelectedIndexChanged
should be ---->> AddHandler actioncombo-1.SelectedIndexChanged, AddressOf ComboBox6_SelectedIndexChanged
End With
Code:
Private Sub ComboBox6_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox6.SelectedIndexChanged
If Combobox6.SelectedItem.ToString = "Navigate to a url" Then
and here is where my prblem lies---->> If [selectedcomboboxname].SelectedItem.ToString = "Navigate to a url" Then
how can i return the name of the selected combobox?
ComboBox3.Visible = False
ComboBox2.Visible = False
TextBox1.Visible = False
TextBox3.Visible = False
Label2.Visible = False
Label8.Visible = False
Label9.Visible = False
Label10.Visible = False
navBox.Visible = True
Else
If ComboBox6.SelectedItem.ToString = "Fill text field" Or ComboBox6.SelectedItem.ToString = "Fill combo box" Then
ComboBox3.Visible = True
ComboBox2.Visible = True
TextBox1.Visible = True
TextBox3.Visible = True
Label2.Visible = True
Label8.Visible = True
Label9.Visible = True
Label10.Visible = True
navBox.Visible = False
Else
ComboBox3.Visible = True
ComboBox2.Visible = True
TextBox1.Visible = True
Label2.Visible = True
Label8.Visible = True
Label9.Visible = True
Label10.Visible = False
TextBox3.Visible = False
navBox.Visible = False
End If
End If
End Sub
|