Andy Green
asked on
Concatenate 2 strings to make a control name
Hi Experts
How would I concatenate 2 strings to make a form control that I can reference with code.
I have a form with several combo box controls, I want a generic fill routine where I pass in the control name and it gets filled.
Here is my routine:
Private Sub Lookup_Fill(ByVal strType As String)
Dim lf As New clsLookups
Dim dt As DataTable = lf.DoLookup(strType)
Dim FormControl = strType
With FormControl
.DataSource = dt
.DisplayMember = "LookUpValue"
.SelectedIndex = 0
End With
End Sub
This is how I call:
Lookup_Fill("Status")
I pass the variable into a proc that return a list (That works OK) I hit a problem when I try to refernce the form control (as a string I guess)
How do do this?
How would I concatenate 2 strings to make a form control that I can reference with code.
I have a form with several combo box controls, I want a generic fill routine where I pass in the control name and it gets filled.
Here is my routine:
Private Sub Lookup_Fill(ByVal strType As String)
Dim lf As New clsLookups
Dim dt As DataTable = lf.DoLookup(strType)
Dim FormControl = strType
With FormControl
.DataSource = dt
.DisplayMember = "LookUpValue"
.SelectedIndex = 0
End With
End Sub
This is how I call:
Lookup_Fill("Status")
I pass the variable into a proc that return a list (That works OK) I hit a problem when I try to refernce the form control (as a string I guess)
How do do this?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER