473,511 Members | 16,068 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Edit button ?HELP PLEASE

15 New Member
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


Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdEdit_Click(Index As Integer)
  2.  
  3. txtFullname.Enabled = True
  4. txtAddress.Enabled = True
  5. txtArea.Enabled = True
  6. txtPostcode.Enabled = True
  7. txtContactno.Enabled = True
  8. txtPos.Enabled = True
  9. txtSalary.Enabled = True
  10.  
  11. End Sub
  12.  
  13. Private Sub cmdExit_Click(Index As Integer)
  14.  
  15. counter = EmployeeCollection.Count
  16.  
  17. Dim forcounter As Integer
  18.  
  19. Open "c:\temp\Storage.txt" For Output As #1
  20.  
  21. For forcounter = 1 To EmployeeCollection.Count
  22.  
  23. Print #1, """" & EmployeeCollection.Item(forcounter).Fullname & """,";
  24. Print #1, EmployeeCollection.Item(forcounter).Address & ",";
  25. Print #1, EmployeeCollection.Item(forcounter).Area & ",";
  26. Print #1, EmployeeCollection.Item(forcounter).Postcode & ",";
  27. Print #1, EmployeeCollection.Item(forcounter).Contactno & ",";
  28. Print #1, EmployeeCollection.Item(forcounter).Pos & ",";
  29. Print #1, EmployeeCollection.Item(forcounter).Salary
  30.  
  31. Next
  32. Close #1
  33. End
  34.  
  35. End Sub
  36.  
  37.  
  38. Private Sub cmdFirst_Click(Index As Integer)
  39.  txtEmployeeno.Text = 1
  40.  
  41.    txtFullname.Text = EmployeeCollection.Item(1).Fullname
  42.     txtAddress.Text = EmployeeCollection.Item(1).Address
  43.     txtArea.Text = EmployeeCollection.Item(1).Area
  44.     txtPostcode.Text = EmployeeCollection.Item(1).Postcode
  45.     txtContactno.Text = EmployeeCollection.Item(1).Contactno
  46.     txtPos.Text = EmployeeCollection.Item(1).Pos
  47.     txtSalary.Text = EmployeeCollection.Item(1).Salary
  48.  
  49.    cmdP.Enabled = False
  50.    cmdNext.Enabled = True
  51.  
  52.  
  53.    If counter - 1 < 1 Then
  54.    MsgBox ("First Record")
  55.  
  56.     End If
  57.  
  58.  
  59. End Sub
  60.  
  61.  Private Sub cmdsave_Click(Index As Integer)
  62.  
  63. Set Employee = New clsEmployee
  64.  
  65.     Employee.Fullname = txtFullname.Text
  66.     Employee.Address = txtAddress.Text
  67.     Employee.Area = txtArea.Text
  68.     Employee.Postcode = txtPostcode.Text
  69.     Employee.Contactno = txtContactno.Text
  70.     Employee.Pos = txtPos.Text
  71.     Employee.Salary = txtSalary.Text
  72.  
  73.         txtFullname.Enabled = False
  74.         txtAddress.Enabled = False
  75.         txtArea.Enabled = False
  76.         txtPostcode.Enabled = False
  77.         txtContactno.Enabled = False
  78.         txtPos.Enabled = False
  79.         txtSalary.Enabled = False
  80.  
  81. EmployeeCollection.Add Employee
  82. txtEmployeeno.Text = EmployeeCollection.Count
  83. Set Employee = Nothing
  84.  
  85. End Sub
  86.  

Really greatfull for n e help
yamasassy
Mar 12 '08 #1
3 1227
gobblegob
133 New Member
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]


Private Sub cmdEdit_Click(Index As Integer)

txtFullname.Enabled = True
txtAddress.Enabled = True
txtArea.Enabled = True
txtPostcode.Enabled = True
txtContactno.Enabled = True
txtPos.Enabled = True
txtSalary.Enabled = True


End Sub


Really greatfull for n e help
yamasassy

So these are not being enabled?

change this..
Private Sub cmdEdit_Click(Index As Integer)

to this..
Private Sub cmdEdit_Click()

GobbleGob.
Mar 12 '08 #2
Yamasassy
15 New Member
sorry didnt make my self clear , when edited the detaikls save again not over write the persons details in the file
Mar 12 '08 #3
gobblegob
133 New Member
Thats becuase your code only enables the objects for use, it doesnt tell your program do anything else.

try this,

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdEdit_Click(Index As Integer)
  2.    Set Employee = New clsEmployee
  3.  
  4.     txtFullname.Enabled = True
  5.     txtAddress.Enabled = True
  6.     txtArea.Enabled = True
  7.     txtPostcode.Enabled = True
  8.     txtContactno.Enabled = True
  9.     txtPos.Enabled = True
  10.     txtSalary.Enabled = True
  11.  
  12.     Employee.Fullname = txtFullname.Text
  13.         Employee.Address = txtAddress.Text
  14.         Employee.Area = txtArea.Text
  15.         Employee.Postcode = txtPostcode.Text
  16.         Employee.Contactno = txtContactno.Text
  17.         Employee.Pos = txtPos.Text
  18.         Employee.Salary = txtSalary.Text
  19.  
  20.     EmployeeCollection.Add Employee
  21.     txtEmployeeno.Text = EmployeeCollection.Count
  22.     Set Employee = Nothing
  23.  
  24. End Sub
GobbleGob.
Mar 13 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

8
2315
by: Gilles T. | last post by:
How I can get element ID in the edit mode of datagrid control? If I not in the edit mode, there are no problem. <asp:TemplateColumn ItemStyle-CssClass="grid_column_width_3"...
4
8363
by: Kevin Myers | last post by:
Hello, Please forgive my reposting of this note with hopefully a more relevant subject line. On an Access 2000 form under Windows 2000 I would like to use a Kodak Image Edit Control to...
4
4394
by: DC | last post by:
Newbie's question about .NET datagrid If I use: <asp:EditCommandColumn></asp:EditCommandColumn> When I edit a row, it will automatically show Update and Cancel Link. But when I use:...
1
2898
by: Ann | last post by:
Hi, I have a datagrid contained textbox in the template column. I want to create a button on each row, when a user hits the button the textbox on column of the datagrid is enabled (no...
4
1967
by: Sourav Dutta Gupta | last post by:
I want to change the "scr" like src='images/Edit.ICO' to src='images/XYZ.ICO' dynamically based on some condition. My EditCommandColumn: <asp:EditCommandColumn ButtonType="LinkButton"...
2
5579
by: WebBuilder451 | last post by:
I'm working through an example of a formview cortrol. I have bound the control to edit, update, insert, delete stored procs. I have a grid view with a button on it that sets the formview to a...
8
1972
by: =?Utf-8?B?bWlrZWc=?= | last post by:
Hi, I am building a small Help Desk application for my company and need to be able to edit "open" help desk issues. I use a simple datagrid to display each issue (6 per page) , with an Edit...
2
2448
by: sowmram | last post by:
Hi, I'm trying to create a site very similar to wiki, where you can edit, save.. Generally update data for the future use... This particular program I wanna do it using javascripts... Please...
1
2009
by: gurmet | last post by:
Hi All I have been looking around for help, and finally post this problem. I created a form to edit a record. Before i can click save button on the edit form i need to check if the data that...
2
3308
by: crapycoder | last post by:
hi all, please help....!! i have added a kodak image edit control on my form. when i click get image button, "abc.img" will be displayed. i have a button named "copy to clipboard". when...
0
7242
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7138
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7075
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7508
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5662
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3222
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3212
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
446
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.