Hi I'm still quite new to VB.NET... I have the following code for a form that has a button (Button1). When I press this button it adds a combobox with some values (it adds a new one underneath each time the button is pushed). How do I set up and event so that when a combobox is changed, a textbox will appear to the right of it? I'm basically looking at having different behaviors based on what is selected in each combobox.
Public Class frmEditor
Private Const rowHeight = 25
Dim datarows() As Action
Dim currentrow As Integer
Dim starttop As Integer
Private Sub frmEditor_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
currentrow = 1
starttop = 20
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
CreateRow()
currentrow = currentrow + 1
starttop = starttop + rowHeight
End Sub
Private Sub CreateRow()
Dim newrow As Action = New Action()
ReDim Preserve datarows(currentrow)
datarows(currentrow) = newrow
datarows(currentrow).newAction(15, starttop, currentrow)
End Sub
End Class
Public Class Action
Private cbo As New ComboBox()
Public Sub newAction(ByVal xleft As Integer, ByVal ytop As Integer, ByVal nrow As Integer)
cbo.Top = ytop
cbo.Left = xleft
cbo.Visible = True
cbo.Items.Add("Test1")
cbo.Items.Add("Test2")
frmEditor.Controls.Add(cbo)
End Sub
End Class