Hello All and thank you in advance.

I am attempting to pass 3 string values to a function to automate filling a series of combo boxes on a form based off of information stored on several tables within a database..
This is the Call:
VB Code:
  1. FillForm("AcolumnName","AtableName","ComboBoxtoFill")

The problem is the Underlined Item within code.
I am not sure of how to translate the Comboboxname from a string to an object im assuming.

I HAVE already attempted to pass the value as an object "
.......,ByVal cboBox As Object.....
But still recived an error at said location but no underline appeard on cbobox in code. So again im stumped. Eventualy there will be 5 or 6 calls to use this function on the Form.

VB Code:
  1. Private Function FillForm(ByVal [B]column[/B] As String, ByVal [B]table[/B] As String, ByVal [B]cbobox[/B] As String)
  2.         Dim myconn As SqlConnection
  3.         Dim mycmd As SqlCommand
  4.         Dim myread As SqlDataReader
  5.         Dim output As String
  6.         Dim outputInt As String
  7.  
  8.         myconn = New SqlConnection (Bla,Bla,Bla)
  9.         myconn.Open()
  10.  
  11.         mycmd = myconn.CreateCommand()
  12.         mycmd.CommandText = ("select " & [B]column[/B] & " from " & [B]table[/B])
  13.         myread = mycmd.ExecuteReader()
  14.         While myread.Read()
  15.             output = output & myread.GetString(0)
  16.             [U][B]cbobox[/B].[/U]Items.Add(output)
  17.             output = ""
  18.         End While
  19.         myread.Close()
  20.         myconn.Close()
  21.         cboLocation.SelectedIndex = 1
  22.        
  23.     End Function