Trouble displaying info from access db

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
_____________________________________________________
 
G

Guest

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top