[size=2][color=#008000]'Function used to load drop down in datagrid
[/color][/size][size=2][color=#0000ff]Function[/color][/size][size=2] GetEquipName() [/size][size=2][color=#0000ff]As[/color][/size][size=2] DataSet
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] connection [/size][size=2][color=#0000ff]As[/color][/size][size=2] SqlConnection
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] strSQL [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] strConn [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String
[/color][/size][size=2]strConn = "bla"
connection = [/size][size=2][color=#0000ff]New[/color][/size][size=2] SqlConnection(strConn)
strSQL = "SELECT EqName,EqTypeID FROM tlkpEquipment"
connection.Open()
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] SQLDSET [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] DataSet
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] DataAdapter [/size][size=2][color=#0000ff]As[/color][/size][size=2] SqlDataAdapter = [/size][size=2][color=#0000ff]New[/color][/size][size=2] SqlDataAdapter(strSQL, connection)
[/size][size=2]DataAdapter.Fill(SQLDSET, "tlkpEquipment")
connection.Close()
[/size][size=2][color=#0000ff]Return[/color][/size][size=2] SQLDSET
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Function[/color][/size]
[size=2][/size][size=2][color=#008000]'Function used to get correct index for drop down
[/color][/size][size=2][color=#0000ff]Function[/color][/size][size=2] GetEqTypeIndex([/size][size=2][color=#0000ff]ByVal[/color][/size][size=2] EqTID [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]String[/color][/size][size=2]) [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Integer
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] iLoop [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]Integer
[/color][/size][size=2][color=#008000]'Loop through each row in the DataSet
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] dt [/size][size=2][color=#0000ff]As[/color][/size][size=2] DataTable = GetEquipName.Tables("tlkpEquipment")
[/size][size=2][color=#0000ff]For[/color][/size][size=2] iLoop = 0 [/size][size=2][color=#0000ff]To[/color][/size][size=2] dt.Rows.Count - 1
[/size][size=2][color=#0000ff]If[/color][/size][size=2] Int32.Parse(EqTID) = Int32.Parse(dt.Rows(iLoop)("EqTypeID")) [/size][size=2][color=#0000ff]Then
[/color][/size][size=2][color=#0000ff]Return[/color][/size][size=2] iLoop
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]If
[/color][/size][size=2][color=#0000ff]Next[/color][/size][size=2] iLoop
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Function
[/color][/size]