S
Shawn
Hello All,
I am trying to raise enter events for a combobox control that I am building
dynamically at run time. A user enters a number in a textbox and that many
comboboxes are created. I then need to populate them with a database query,
but can seem to find a way to get any more than the last control to respond.
I have them being named differently, but only the base name shows for
events. Below is my code...
Dim WithEvents ctlComboBox As Control
Private Sub frmAddPeopleToGroup_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
CreateControls()
MakeTable()
End Sub
Private Sub CreateControls()
Static LocationStart As Integer = 50
Dim vbFont As New Font("Baskerville Old Face", 10)
Dim i As Integer
For i = 0 To frmAddGroup.vbPeopleCount - 1
ctlComboBox = New ComboBox()
With ctlComboBox
.Name = "cmbPeople" & i
.Location = New Point(20, LocationStart)
.Width = 250
.Font = vbFont
End With
LocationStart += 30
Me.Controls.Add(ctlComboBox)
Next
End Sub
Thanks!!
I am trying to raise enter events for a combobox control that I am building
dynamically at run time. A user enters a number in a textbox and that many
comboboxes are created. I then need to populate them with a database query,
but can seem to find a way to get any more than the last control to respond.
I have them being named differently, but only the base name shows for
events. Below is my code...
Dim WithEvents ctlComboBox As Control
Private Sub frmAddPeopleToGroup_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load
CreateControls()
MakeTable()
End Sub
Private Sub CreateControls()
Static LocationStart As Integer = 50
Dim vbFont As New Font("Baskerville Old Face", 10)
Dim i As Integer
For i = 0 To frmAddGroup.vbPeopleCount - 1
ctlComboBox = New ComboBox()
With ctlComboBox
.Name = "cmbPeople" & i
.Location = New Point(20, LocationStart)
.Width = 250
.Font = vbFont
End With
LocationStart += 30
Me.Controls.Add(ctlComboBox)
Next
End Sub
Thanks!!