Trouble displaying info from access db

  • Thread starter Thread starter GeekyChicky79
  • Start date Start date
G

GeekyChicky79

Hi Everyone,

I have the project below where I'm pulling out information from 1 table

"Subjects", pulling the Subjects, and SubjectCode. The Subjects are
displaying in the Combo Box just fine, but I can not get the
corresponding Subject Code to display in the Label.


I have 2 Data adapters/dataset,1 for Subjects, and the other for
SubjectCode, along with a Data View setup.


I'm a newbie on VB.NET. This project is pulling from an Access DB. Is
there anything that I should be looking for, or doing wrong that I'm
not getting the Subject Code to display in the Label?


Any help would be appreciated.


__________________________________
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Fill the List box
dbSubject.Fill(DsSubject1)
dbSubjectCode.Fill(DsSubjectCode2)
DisplayRecordPosition()
End Sub


Private Sub cboSubjectName_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
cboSubjectName.SelectedIndexChanged
' DsSubject1.Clear()
' dbSubject.SelectCommand.Parameters("Subjects").Value =
cboSubjectName.Text
' dbSubjectCode.Fill(DsSubjectCode2)
End Sub


Private Sub lblSubName_Click(ByVal sender As System.Object, ByVal e

As System.EventArgs) Handles lblSubName.Click
DsSubjectCode2.Clear()
dbSubjectCode.SelectCommand.Parameters("SubjectCode").Value =
lblSubName.Text
dbSubjectCode.Fill(DsSubjectCode2)


End Sub
'*****General Procedures*****
Private Sub DisplayRecordPosition()
Dim intRecordCount As Integer
Dim intRecordPosition As Integer


intRecordCount = DsSubject1.Tables("Subjects").Rows.Count


If intRecordCount = 0 Then
lblSubName.Text = "(No records)"
Else
intRecordPosition = Me.BindingContext(DsSubject1,
"Subjects").Position + 1
lblSubName.Text = "Record: " & intRecordPosition.ToString _

& " of " & intRecordCount.ToString
End If
End Sub
End Class
_____________________________________________________
 
Is lblSubName the name or your label?

You are trying to get the code in the lable to change when you change the
selection in the combo box correct? Also have you hooked a debugger to the
code and checked that the code values are being placed in the dataset?
--
Jason Fortner

MCAD .NET, MCSD .NET, Sharepoint Development
Total Productivity Solutions, Inc.
http://totalproductivitysolutions.com
 
Back
Top