Link to home
Start Free TrialLog in
Avatar of Andy Green
Andy GreenFlag for United Kingdom of Great Britain and Northern Ireland

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?
ASKER CERTIFIED SOLUTION
Avatar of Wayne Taylor (webtubbs)
Wayne Taylor (webtubbs)
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Andy Green

ASKER

Excellent, Cut and paste and it worked first time.