I have a combobox issue that I am unable to figure out. There are three comboboxes, each of which serve an identical purpose, and each of which is populated from a different table.
The three comboboxes are bound to the tables as can be seen below. Now as far as I know these are the only places where the combobox is touched by the code.
Each of the comboboxes are bound to each of three tables. The only table properties I touch in the code are the enabled, and tabStop properties.
The issue is the text showing in the first combobox. What should be displayed and is bound to the combobox text property is the type of document. The data displayed in the first combobox is the data from another column in the table.
There are no errors and I have been unable to think of what is going on. I am sure that there is a code mistake somewhere, but I have no idea how to find it. I have pretty much used up everything I know to look for.
Code:Public Sub GetTypeComboBox() cboType.Items.Clear() MasterBase.MasterBaseQuery("SELECT colType From lkpDoc") If RecordCount > 0 Then For Each r As DataRow In MasterBase.ListDataSet.Tables(0).Rows cboType.Items.Add(r("colType")) Next End If End SubCode:Public Sub GetDeptComboBox() cboOwner.Items.Clear() MasterBase.MasterBaseQuery("SELECT colDept From lkpDept") If RecordCount > 0 Then For Each r As DataRow In MasterBase.ListDataSet.Tables(0).Rows cboOwner.Items.Add(r("colDept")) Next End If End SubCode:Public Sub GetWhereComboBox() cboWhere.Items.Clear() MasterBase.MasterBaseQuery("SELECT colWhere From lkpWhere") If RecordCount > 0 Then For Each r As DataRow In MasterBase.ListDataSet.Tables(0).Rows cboWhere.Items.Add(r("colWhere")) Next End If End SubCode:cboType.DataBindings.Add("Text", MasterBase.listTable, "colType") cboOwner.DataBindings.Add("Text", MasterBase.listTable, "colOwner") cboWhere.DataBindings.Add("Text", MasterBase.listTable, "colWhere")Code:Private Function GetDocument(ByVal SystemID As String) As Object 'Add Parameters MasterBase.AddParam("@recno", SystemID) #Region "Establish Connection and execute Query" Try Dim RecordCount = 0 MasterBase.Exception = "" MyError = "Failed to find the selected document." MasterBase.MasterBaseQuery("SELECT colSystemID,colRev,colName,colDetail,colFilePath,colChangePath " & "colType,colOwner,colWhere,colActive,colObsolete " & "FROM sitDocMaster " & "WHERE colSystemID = @recno") MyRev = MasterBase.listTable.Rows(0).Item(1).ToString MyDocument = MasterBase.listTable.Rows(0).Item(0).ToString + "." + MasterBase.listTable.Rows(0).Item(1).ToString + "." + "Draft" Catch ex As Exception MasterBase.Exception = ex.Message MsgBox(ex.Message + vbCrLf + MyError) Me.Close() End Try Return SystemID #End Region End Function




Reply With Quote
