|
|
|
| Web Hosting |
![]() ![]() |
Updating Values In A Text Box |
Aug 19 2007, 10:05 AM
Post
#1
|
|
|
Living at the Datacenter Group: [HOSTED] Posts: 708 Joined: 30-June 06 From: Australia Member No.: 14,219 myCENTs:76.93 |
Hi All,
These are the steps in which the program works Load Data into text box > Line by Line copy the data into list boxes > Load data into separate form from text boxes. What I am having problems with is when I want to edit the data that is on the other form. Each different value has a text box and what I am trying to do is to update the original text box so that I can save the file onto the computer. But because the original text box already contains the data, I cannot just add new lines to the end of the text box, because I would then have two entries. What I'm looking for is a way of updating the lines in the text box. Or, if I move the new data back into the list boxes, what Is the easiest way to move data from the list boxes to a text box. Thanks, -jimmy |
|
|
|
Aug 19 2007, 12:08 PM
Post
#2
|
|
|
Super Member Group: [HOSTED] Posts: 500 Joined: 5-November 06 Member No.: 17,016 myCENTs:79.88 |
Don't quite get what you want.
Normally I would have a list box on the left, then a few textbox on the right side to display detail info. Then I bind the SelectedIndexChanged event, and then check the list box SelectedItem count, make sure it's one(It can be zero). If it's one, then display the detail of the selected item on the right hand side (either with SelectedItems(0).Text OR query from database, I usually store the ID in the "Tag" of the listbox item), at the same time enable the "Save" button. If it's not one, then clear all the text box, and make the "Save" button disabled. Hope this can help you a bit |
|
|
|
Aug 20 2007, 07:22 AM
Post
#3
|
|
|
Living at the Datacenter Group: [HOSTED] Posts: 708 Joined: 30-June 06 From: Australia Member No.: 14,219 myCENTs:76.93 |
I'll try and explain it a bit more.
The external file has list of items, of which there are 13 details for each item. So the file reads 1,2,3..13 then starts at 1 again for the next item. When the program reads the file, it puts each of the details in its own list box (so there are 13 list boxes). So in one list box, I will have all the one detail for all the items, and so on for all the other items. When you type in the ID number for a item (the ID is the first detail) the first list box will find the ID number and select it. Using the SelectedIndex, all the other list boxes will select the detail for each item. Then the details from each of the list boxes are displayed in text boxes and labels, so they are nicely formatted for the end user. Now the end user can change the text in the text boxes and this is what I want to save. What would be the easiest way of saving the 'new' (or updated) details for the item back into the external file? Thanks, -jimmy |
|
|
|
Aug 20 2007, 07:54 AM
Post
#4
|
|
|
Premium Member Group: [HOSTED] Posts: 286 Joined: 17-June 07 From: Tasmania Member No.: 22,699 |
use $_POST to collect the variables from the text box, then use fopen() to edit the file. If you're havig trouble checking what the ID of the item is, then add <input type="hidden" name="id" value="[ID Here]"> at the start of the text boxes, and you can retrieve it from $_POST["id"].
Hope that answers your question! |
|
|
|
Aug 20 2007, 08:12 AM
Post
#5
|
|
|
Living at the Datacenter Group: [HOSTED] Posts: 708 Joined: 30-June 06 From: Australia Member No.: 14,219 myCENTs:76.93 |
Sorry, but I;m programming it in VB.NET, not PHP! I should have mentioned it, but being in the VB Forum.
|
|
|
|
Aug 21 2007, 08:33 AM
Post
#6
|
|
|
Super Member Group: [HOSTED] Posts: 500 Joined: 5-November 06 Member No.: 17,016 myCENTs:79.88 |
QUOTE(Jimmy89 @ Aug 20 2007, 03:22 PM) [snapback]109542[/snapback] I'll try and explain it a bit more. The external file has list of items, of which there are 13 details for each item. So the file reads 1,2,3..13 then starts at 1 again for the next item. When the program reads the file, it puts each of the details in its own list box (so there are 13 list boxes). So in one list box, I will have all the one detail for all the items, and so on for all the other items. When you type in the ID number for a item (the ID is the first detail) the first list box will find the ID number and select it. Using the SelectedIndex, all the other list boxes will select the detail for each item. Then the details from each of the list boxes are displayed in text boxes and labels, so they are nicely formatted for the end user. Now the end user can change the text in the text boxes and this is what I want to save. What would be the easiest way of saving the 'new' (or updated) details for the item back into the external file? Thanks, -jimmy Now i get you. Sorry for the late reply, I was traveling back to my home town. OK, you idea seems a bit confusing to the user, IMHO. I would recommend you using a listview, and have 13 column. So when the user selected that particular row, you then enable an edit button. The user can either click Edit or double click, which will then bring up a dialog box with the 13 details particular to that ID. Then you can do saving from there, it's quite straight forward after that. If the user decided to cancel the changes, you just need to close the dialog box. Optionally you can set DialogResult to Cancel. For successful save, you can return OK, so that your main form can refresh the listview. The reason i recommend this is that, your method, it's hard for user to decide on canceling and saving, you can select a ID, then edit the text box, then select a diff one, you then need to intervene if the user would like to discard the changes or not. So you need to trap quite a lot event to handle the user friendliness. It become tedious if the user was prompt all the time even though he just want to discard the changes. It might happen that he didn't change anything, and also being prompt, unless you trap all the text box with the OnChange event to take note of the changes. The dialog box, to cancel, the user just need to press Esc, or click cancel, it's quite a standard feature. With a dialog box, you also narrow down the problem and bugs, and give the user a focus job. |
|
|
|
Aug 21 2007, 08:57 AM
Post
#7
|
|
|
Premium Member Group: [HOSTED] Posts: 286 Joined: 17-June 07 From: Tasmania Member No.: 22,699 |
QUOTE(Jimmy89 @ Aug 20 2007, 08:12 AM) [snapback]109545[/snapback] Sorry, but I;m programming it in VB.NET, not PHP! I should have mentioned it, but being in the VB Forum. Sorry! *goes all embarrassed* My bad, but the principle should generally be the same, I think |
|
|
|
Aug 21 2007, 12:36 PM
Post
#8
|
|
|
Living at the Datacenter Group: [HOSTED] Posts: 708 Joined: 30-June 06 From: Australia Member No.: 14,219 myCENTs:76.93 |
Habble, I done it before too!
ok, that make sense so far. How is the easiest way to make the list box with 13 columns? in coding terms of cause. What code would I need to pull the information from the text box (or the external file) and format it in the columns? Please correct me If im wrong, but when the dialog appears it takes the selected information (of the item thats being edited) and displays it for editing. Then, when the changes are accepted (OK button pressed) it copies the information back into the listbox. Then, how can I save this listbox? Is there a simple way of reading all the lines and then saving them into a file? Thanks Heaps, -jimmy This post has been edited by Jimmy89: Aug 21 2007, 12:38 PM |
|
|
|
Aug 22 2007, 08:16 AM
Post
#9
|
|
|
Super Member Group: [HOSTED] Posts: 500 Joined: 5-November 06 Member No.: 17,016 myCENTs:79.88 |
QUOTE(Jimmy89 @ Aug 21 2007, 08:36 PM) [snapback]109591[/snapback] ok, that make sense so far. How is the easiest way to make the list box with 13 columns? in coding terms of cause. What code would I need to pull the information from the text box (or the external file) and format it in the columns? CODE listview.Items.Add(New ListViewItem(New String() {"column1", "column2", "column3"})) It's better to use ListView, use Details mode for View's property. You need to configure the columns manually, so after inserting, it will goes according to what column you have configured. QUOTE(Jimmy89 @ Aug 21 2007, 08:36 PM) [snapback]109591[/snapback] Then, how can I save this listbox? Is there a simple way of reading all the lines and then saving them into a file? You don't actually save the listbox, when the user press OK, it's save right away. Then the listbox is refresh the display the latest data. If you need to keep the all the data temporarily, but not saving it all the time, then write a class or use collection to keep the data, any changes should be applied there, then save only when at the point where you want it to.(Save All) |
|
|
|
Aug 23 2007, 07:17 AM
Post
#10
|
|
|
Living at the Datacenter Group: [HOSTED] Posts: 708 Joined: 30-June 06 From: Australia Member No.: 14,219 myCENTs:76.93 |
QUOTE You don't actually save the listbox, when the user press OK, it's save right away. I don't quite understand what you mean, when the values in the 'detail' view are changed and the OK button is press, how do I save those values into the text file I have already, but not making a second entry under the same ID (so appending the data thats there already)
|
|
|
|
![]() ![]() |
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
Similar Topics
| Topic Title | Replies | Topic Starter | Views | Last Action | ||
|---|---|---|---|---|---|---|
![]() |
1 | dhanesh | 742 | 6th January 2009 - 06:33 AM Last post by: iG-naryan |
||
![]() |
0 | zainboy | 109 | 25th December 2008 - 08:50 PM Last post by: zainboy |
||
![]() |
14 | Mr 85 | 1,667 | 17th December 2008 - 03:44 PM Last post by: ryantommo |
||
![]() |
3 | nighthawk16 | 2,262 | 14th December 2008 - 05:51 PM Last post by: iG-Kudos |
||
![]() |
2 | denverporia19 | 1,872 | 11th December 2008 - 10:36 PM Last post by: iG-Marble |
||
Expand / Collapse Navigation



Aug 19 2007, 10:05 AM




