i have an edit button that is supposed enable the txt boxes to be able to write in it does this but when i click save i want the edited person to save
[code=vb]
Private Sub cmdEdit_Click(I ndex As Integer)
txtFullname.Ena bled = True
txtAddress.Enab led = True
txtArea.Enabled = True
txtPostcode.Ena bled = True
txtContactno.En abled = True
txtPos.Enabled = True
txtSalary.Enabl ed = True
End Sub
Private Sub cmdExit_Click(I ndex As Integer)
counter = EmployeeCollect ion.Count
Dim forcounter As Integer
Open "c:\temp\Storag e.txt" For Output As #1
For forcounter = 1 To EmployeeCollect ion.Count
Print #1, """" & EmployeeCollect ion.Item(forcou nter).Fullname & """,";
Print #1, EmployeeCollect ion.Item(forcou nter).Address & ",";
Print #1, EmployeeCollect ion.Item(forcou nter).Area & ",";
Print #1, EmployeeCollect ion.Item(forcou nter).Postcode & ",";
Print #1, EmployeeCollect ion.Item(forcou nter).Contactno & ",";
Print #1, EmployeeCollect ion.Item(forcou nter).Pos & ",";
Print #1, EmployeeCollect ion.Item(forcou nter).Salary
Next
Close #1
End
End Sub
Private Sub cmdFirst_Click( Index As Integer)
txtEmployeeno.T ext = 1
txtFullname.Tex t = EmployeeCollect ion.Item(1).Ful lname
txtAddress.Text = EmployeeCollect ion.Item(1).Add ress
txtArea.Text = EmployeeCollect ion.Item(1).Are a
txtPostcode.Tex t = EmployeeCollect ion.Item(1).Pos tcode
txtContactno.Te xt = EmployeeCollect ion.Item(1).Con tactno
txtPos.Text = EmployeeCollect ion.Item(1).Pos
txtSalary.Text = EmployeeCollect ion.Item(1).Sal ary
cmdP.Enabled = False
cmdNext.Enabled = True
If counter - 1 < 1 Then
MsgBox ("First Record")
End If
End Sub
Private Sub cmdsave_Click(I ndex As Integer)
Set Employee = New clsEmployee
Employee.Fullna me = txtFullname.Tex t
Employee.Addres s = txtAddress.Text
Employee.Area = txtArea.Text
Employee.Postco de = txtPostcode.Tex t
Employee.Contac tno = txtContactno.Te xt
Employee.Pos = txtPos.Text
Employee.Salary = txtSalary.Text
txtFullname.Ena bled = False
txtAddress.Enab led = False
txtArea.Enabled = False
txtPostcode.Ena bled = False
txtContactno.En abled = False
txtPos.Enabled = False
txtSalary.Enabl ed = False
EmployeeCollect ion.Add Employee
txtEmployeeno.T ext = EmployeeCollect ion.Count
Set Employee = Nothing
End Sub
[/code]
Really greatfull for n e help
yamasassy
[code=vb]
Private Sub cmdEdit_Click(I ndex As Integer)
txtFullname.Ena bled = True
txtAddress.Enab led = True
txtArea.Enabled = True
txtPostcode.Ena bled = True
txtContactno.En abled = True
txtPos.Enabled = True
txtSalary.Enabl ed = True
End Sub
Private Sub cmdExit_Click(I ndex As Integer)
counter = EmployeeCollect ion.Count
Dim forcounter As Integer
Open "c:\temp\Storag e.txt" For Output As #1
For forcounter = 1 To EmployeeCollect ion.Count
Print #1, """" & EmployeeCollect ion.Item(forcou nter).Fullname & """,";
Print #1, EmployeeCollect ion.Item(forcou nter).Address & ",";
Print #1, EmployeeCollect ion.Item(forcou nter).Area & ",";
Print #1, EmployeeCollect ion.Item(forcou nter).Postcode & ",";
Print #1, EmployeeCollect ion.Item(forcou nter).Contactno & ",";
Print #1, EmployeeCollect ion.Item(forcou nter).Pos & ",";
Print #1, EmployeeCollect ion.Item(forcou nter).Salary
Next
Close #1
End
End Sub
Private Sub cmdFirst_Click( Index As Integer)
txtEmployeeno.T ext = 1
txtFullname.Tex t = EmployeeCollect ion.Item(1).Ful lname
txtAddress.Text = EmployeeCollect ion.Item(1).Add ress
txtArea.Text = EmployeeCollect ion.Item(1).Are a
txtPostcode.Tex t = EmployeeCollect ion.Item(1).Pos tcode
txtContactno.Te xt = EmployeeCollect ion.Item(1).Con tactno
txtPos.Text = EmployeeCollect ion.Item(1).Pos
txtSalary.Text = EmployeeCollect ion.Item(1).Sal ary
cmdP.Enabled = False
cmdNext.Enabled = True
If counter - 1 < 1 Then
MsgBox ("First Record")
End If
End Sub
Private Sub cmdsave_Click(I ndex As Integer)
Set Employee = New clsEmployee
Employee.Fullna me = txtFullname.Tex t
Employee.Addres s = txtAddress.Text
Employee.Area = txtArea.Text
Employee.Postco de = txtPostcode.Tex t
Employee.Contac tno = txtContactno.Te xt
Employee.Pos = txtPos.Text
Employee.Salary = txtSalary.Text
txtFullname.Ena bled = False
txtAddress.Enab led = False
txtArea.Enabled = False
txtPostcode.Ena bled = False
txtContactno.En abled = False
txtPos.Enabled = False
txtSalary.Enabl ed = False
EmployeeCollect ion.Add Employee
txtEmployeeno.T ext = EmployeeCollect ion.Count
Set Employee = Nothing
End Sub
[/code]
Really greatfull for n e help
yamasassy
Comment