hi, All I am working on a school project out the book visual basic 2010 fifth edition by tony gladdis. I am in chapter 9 pg592 programming challenge number 2.
I am suspose to create a program that reads the records That I created in first part of this challange. I got that part (writing the file down). When I go to read them nothing goes into my label boxes.
I have my code as follows. I am not sure why my label boxes will not show any output.
Any help would be GREAT.
Thanks in advance.
Imports System.IO
Public Class frmEmpData
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
'Close the program
Me.Close()
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
'clear the lableboxes
lblFirstName.Text = ""
lblMiddleName.Text = ""
LBLLastName.Text = ""
lblEmployeeNumber.Text = ""
lblDepartment.Text = ""
lblTelephone.Text = ""
lblExtension.Text = ""
lblEmailAddy.Text = ""
' set the focus to txtFstName
lblFirstName.Focus()
End Sub
Public Sub btnNextRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNextRecord.Click
'declarations
Dim incount As Integer = 1
Dim blnsearchfound As Boolean
Dim employeefile As StreamReader 'Reads Data
Dim strfirstname As String 'first name
Dim strmidname As String 'middle name
Dim strlstname As String 'last name
Dim strempnum As String 'Employee Number
Dim cmbdept As String 'department
Dim strtele As String 'pone number
Dim strext As String 'phone extension
Dim stremail As String ' Email
'open the file
employeefile = File.OpenText("Employeefile.txt")
'put data in lable boxes
If blnsearchfound = True Then
MessageBox.Show("Records Found!")
lblFirstName.Text = strfirstname.ToString()
lblMiddleName.Text = strmidname.ToString()
LBLLastName.Text = strlstname.ToString()
lblEmployeeNumber.Text = strempnum.ToString()
lblDepartment.Text = cmbdept.ToString()
lblTelephone.Text = strtele.ToString()
lblExtension.Text = strext.ToString()
lblEmailAddy.Text = stremail.ToString()
incount += 1
End If
employeefile.Close() 'close the StreamReader
If incount = 4 Then
MessageBox.Show("There are no more entries")
End If
End Sub
End Class
I am suspose to create a program that reads the records That I created in first part of this challange. I got that part (writing the file down). When I go to read them nothing goes into my label boxes.
I have my code as follows. I am not sure why my label boxes will not show any output.
Any help would be GREAT.
Thanks in advance.
Imports System.IO
Public Class frmEmpData
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
'Close the program
Me.Close()
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
'clear the lableboxes
lblFirstName.Text = ""
lblMiddleName.Text = ""
LBLLastName.Text = ""
lblEmployeeNumber.Text = ""
lblDepartment.Text = ""
lblTelephone.Text = ""
lblExtension.Text = ""
lblEmailAddy.Text = ""
' set the focus to txtFstName
lblFirstName.Focus()
End Sub
Public Sub btnNextRecord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnNextRecord.Click
'declarations
Dim incount As Integer = 1
Dim blnsearchfound As Boolean
Dim employeefile As StreamReader 'Reads Data
Dim strfirstname As String 'first name
Dim strmidname As String 'middle name
Dim strlstname As String 'last name
Dim strempnum As String 'Employee Number
Dim cmbdept As String 'department
Dim strtele As String 'pone number
Dim strext As String 'phone extension
Dim stremail As String ' Email
'open the file
employeefile = File.OpenText("Employeefile.txt")
'put data in lable boxes
If blnsearchfound = True Then
MessageBox.Show("Records Found!")
lblFirstName.Text = strfirstname.ToString()
lblMiddleName.Text = strmidname.ToString()
LBLLastName.Text = strlstname.ToString()
lblEmployeeNumber.Text = strempnum.ToString()
lblDepartment.Text = cmbdept.ToString()
lblTelephone.Text = strtele.ToString()
lblExtension.Text = strext.ToString()
lblEmailAddy.Text = stremail.ToString()
incount += 1
End If
employeefile.Close() 'close the StreamReader
If incount = 4 Then
MessageBox.Show("There are no more entries")
End If
End Sub
End Class