KillerTomato
Member
- Joined
- Mar 20, 2007
- Messages
- 6
- Programming Experience
- 1-3
Hey yall, I am working on a POS System for a client of mine, and right now I need a little help with Employee File Creations. Below is my code, but first the problem. I AM able to creat a employee file. But after I create oen I must restarts the program to make another one. This would work great if the client only had one employee, but they dont. I've been looking at this code for the past hour and a half trying to see what I am doing wrong. Either it's because I'm tired, or I cant program, I'll let yall decide but just look at my code and tell me what I am overlooking, or what I dont have or something. Thanks
Employee Class: SaveEmployee, and EmployeeExists Sub's
Manager Control Panel: Save/Make Employee File
So can yall see anything? I cant but maybe it's just me. Thanks again.
Employee Class: SaveEmployee, and EmployeeExists Sub's
VB.NET:
Imports System.IO
Module Employee
' Employee name Info
Dim first = managercp.txtfirst.Text
Dim middle = managercp.txtmiddle.Text
Dim last = managercp.txtlast.Text
' Address Info
Dim address = managercp.txtaddress.Text
Dim city = managercp.txtcity.Text
Dim state = managercp.txtstate.Text
Dim zip = managercp.txtzip.Text.ToString
' Birthday
Dim bday = managercp.txtbday.Text.ToString
' Home Phone
Dim hphone = managercp.txthome.Text.ToString
' Cell Phone
Dim cphone = managercp.txtcell.Text.ToString
' Social Security Number
Dim ssn = managercp.txtssn.Text.ToString
' Employee Number + Employee File
Dim number = managercp.txtnumber.Text.ToString
' Empty the Text Boxes
Sub Save()
File.WriteAllText(My.Application.Info.DirectoryPath & "\" & number & ".emp", _
"-Employee Name Info-:" + vbCrLf _
& first + " " & middle + " " & last + vbCrLf _
& "-Employee Address Info-:" + vbCrLf _
& address + vbCrLf & city + vbCrLf & state + vbCrLf & zip + vbCrLf _
& "-Employee Info-:" + vbCrLf _
& bday + vbCrLf & hphone + vbCrLf & cphone + vbCrLf _
& "-Employee Social Security Number-:" + vbCrLf _
& ssn)
' Clear TextBoxes
first = ""
middle = ""
last = ""
address = ""
city = ""
state = ""
zip = ""
bday = ""
hphone = ""
cphone = ""
ssn = ""
number = ""
End Sub
Sub EmpExists()
MsgBox("Employee File with that number already exists. Please specify a new number, or delete the existing Employee File.", _
MsgBoxStyle.Critical, "Employee File Error")
End Sub
End Module
Manager Control Panel: Save/Make Employee File
VB.NET:
Private Sub save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save.Click
If My.Computer.FileSystem.FileExists(My.Application.Info.DirectoryPath & "\" & txtnumber.Text & ".emp") Then
Employee.EmpExists()
End If
Employee.Save()
End Sub
So can yall see anything? I cant but maybe it's just me. Thanks again.