Hello All,
I am writing a small program and i have recently encountered a problem that i cant seem to find a solution to. I have 2 listboxes on a single page, and I am trying to populate both of them according to certain SQL commands. When I put one infront of the other, the one in front works, when I switch them, again the one infront works. The one that always comes later always displays "System.Data.DataRowView" instead of the entry its supposed to. Here is the code.
Any help is much appreciated seeing as I am lost. I have tried to open several connections closing one in front of another to populate the second listbox but to no avail. I have also tried to almost every solution I could find online, including ones regarding "ValueMember" etc. No avail. Again the problem is that the listbox code that comes first always displays properly, the one that comes second in the code always displays "System.Data.DataRowView" and I am not quite sure why.
acidflash
I am writing a small program and i have recently encountered a problem that i cant seem to find a solution to. I have 2 listboxes on a single page, and I am trying to populate both of them according to certain SQL commands. When I put one infront of the other, the one in front works, when I switch them, again the one infront works. The one that always comes later always displays "System.Data.DataRowView" instead of the entry its supposed to. Here is the code.
VB.NET:
Private Sub Service_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ClientsConnection.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source =" & Application.StartupPath & "\SS Solutions.mdb"
ClientsConnection.Open()
ClientsString = "SELECT * FROM Clients"
ClientsDA = New OleDb.OleDbDataAdapter(ClientsString, ClientsConnection)
ClientsDA.Fill(ClientsDS, "ClientsMain")
ClientsInc = 0
PendingString = "SELECT * FROM Clients WHERE Installed ='Not Installed'"
PendingDA = New OleDb.OleDbDataAdapter(PendingString, ClientsConnection)
PendingDA.Fill(PendingDS, "PendingMain")
PendingInc = 0
Dim Caption As New ToolTip()
' Set up the delays for the ToolTip.
Caption.AutoPopDelay = 5000
Caption.InitialDelay = 100
Caption.ReshowDelay = 500
' Force the ToolTip text to be displayed whether or not the form is active.
Caption.ShowAlways = True
' Set up the ToolTip text for the Button and Checkbox.
Caption.SetToolTip(Me.bAddClient, "Add client")
Caption.SetToolTip(Me.bRemoveClient, "Remove client")
Caption.SetToolTip(Me.bSearch, "Search")
Caption.SetToolTip(Me.bReport, "Report")
DateOfCall.Text = System.DateTime.Today
dt = ClientsDS.Tables("ClientsMain")
dt2 = PendingDS.Tables("PendingMain")
lstClients.DataSource = dt
lstPending.DataSource = dt2
lstClients.DisplayMember = "FirstName"
lstClients.DataBindings.Add("Name", ClientsConnection, "FirstName")
lstPending.DisplayMember = "FirstName"
lstPending.DataBindings.Add("FirstName", ClientsConnection, "FirstName")
CalculateAccessPoints()
CalculateInstalled()
CalculatePending()
lblNumOfUsers.Text = dt.Rows.Count
lblTotalInstalled.Text = TotalInstalledUsers
lblTotalPending.Text = TotalPendingUsers
lblNumOfAp.Text = TotalAccessPoints
End Sub
Any help is much appreciated seeing as I am lost. I have tried to open several connections closing one in front of another to populate the second listbox but to no avail. I have also tried to almost every solution I could find online, including ones regarding "ValueMember" etc. No avail. Again the problem is that the listbox code that comes first always displays properly, the one that comes second in the code always displays "System.Data.DataRowView" and I am not quite sure why.
acidflash