![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 | |
|
Expert Programmer
|
Quote:
__________________
"When in Rome, Do as the Romans Do" "Beauty is in the eye of the BEER holder" "Save your breath your going to need it for your blow up doll later" SearchLores.org |
|
|
|
|
|
|
#12 |
|
Expert Programmer
|
Fixed
As I said before, in order to save the employee information to a new file the new employee number must be stored in the number variable before you save the file. What you did was initialize your variables with the first set of values. The next employee you attempt to save will have blank values because the new values are not being stored before the save. I mailed your project back to you.
Old Code: ' 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 SubNew Code: ' Employee name Info
Dim first As String
Dim middle As String
Dim last As String
' Address Info
Dim address As String
Dim city As String
Dim state As String
Dim zip As String
' Birthday
Dim bday As String
' Home Phone
Dim hphone As String
' Cell Phone
Dim cphone As String
' Social Security Number
Dim ssn As String
' Employee Number + Employee File
Dim number As String
' Empty the Text Boxes
Sub Save()
first = managercp.txtfirst.Text
middle = managercp.txtmiddle.Text
last = managercp.txtlast.Text
address = managercp.txtaddress.Text
city = managercp.txtcity.Text
state = managercp.txtstate.Text
zip = managercp.txtzip.Text.ToString
bday = managercp.txtbday.Text.ToString
hphone = managercp.txthome.Text.ToString
cphone = managercp.txtcell.Text.ToString
ssn = managercp.txtssn.Text.ToString
number = managercp.txtnumber.Text.ToString
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
__________________
"When in Rome, Do as the Romans Do" "Beauty is in the eye of the BEER holder" "Save your breath your going to need it for your blow up doll later" SearchLores.org |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| problem processing file into a char array | csrocker101 | C++ | 1 | May 8th, 2007 11:50 PM |
| OnlineTextEditor.Com! | Sane | Show Off Your Open Source Projects | 43 | Jun 16th, 2006 8:55 AM |
| Writing to a file from a TSR (MASM16) | Roku | Assembly | 2 | Apr 29th, 2006 7:08 PM |
| After execution - Error cannot locate /Skin File? | wchar | Visual Basic | 1 | Mar 5th, 2005 9:04 PM |
| airport Log program using 3D linked List : problem reading from file | gemini_shooter | C++ | 0 | Mar 2nd, 2005 4:12 PM |