Trouble displaying info from access db

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



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
_____________________________________________________

.



Relevant Pages

  • RE: Trouble displaying info from access db
    ... Is lblSubName the name or your label? ... not getting the Subject Code to display in the Label? ... Private Sub Form1_Load(ByVal sender As System.Object, ... Dim intRecordCount As Integer ...
    (microsoft.public.dotnet.framework.adonet)
  • Re: Printing the Form
    ... Private Sub Command1_Click ... The problem with parts of your drawing failing to print is probably because your PictureBoxes are not Autoredraw, but the PrintForm method also has various other problems printing the contents or background of containers, especially if they are themselves contained in other containers. ... There are many ways of doing this, depending on whether the Form you wish to print is fully visible on the display at the time you want to print it, or whether you wish to print a Form that is not fully visible on the display, and in some cases depending on whether you wish the code to work on versions of Windows prioer to XP. ...
    (microsoft.public.vb.general.discussion)
  • Trouble displaying info from access db
    ... "Subjects", pulling the Subjects, and SubjectCode. ... not getting the Subject Code to display in the Label? ... Private Sub Form1_Load(ByVal sender As System.Object, ... Dim intRecordCount As Integer ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: From Help
    ... To see how my approach works, create a new document called Test1. ... This will create a user form named UserForm1. ... Private Sub CommandButton1_Click ... This should display the code for the Document_New ...
    (microsoft.public.word.vba.general)
  • Re: Combo Box text display problem based on AfterUpdate...
    ... Private Sub Form_Current ... The cboStore and cboEmployee display fine. ... "Ken Snell " wrote: ... <MS ACCESS MVP> ...
    (microsoft.public.access.forms)