Updating Values In A Text Box

Pages: 1, 2
free web hosting

Read Latest Entries..: (Post #11) by Jimmy89 on Aug 24 2007, 01:27 AM. (Line Breaks Removed)
thanks for that! I will try what you have suggested so far and get back to you with any problems, if you don't mind
Read the FIRST post of this Topic. - Express your Opinion! Contribute Knowledge :-).

Free Web Hosting > Computers & Tech > Programming > Programming General > BASIC / Visual Basic (.NET)

Updating Values In A Text Box

Jimmy89
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

Reply

faulty.lee
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

Reply

Jimmy89
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

Reply

Habble
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!

Reply

Jimmy89
Sorry, but I;m programming it in VB.NET, not PHP! I should have mentioned it, but being in the VB Forum.

Reply

faulty.lee
QUOTE(Jimmy89 @ Aug 20 2007, 03:22 PM) *
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.

 

 

 


Reply

Habble
QUOTE(Jimmy89 @ Aug 20 2007, 08:12 AM) *
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

Reply

Jimmy89
Habble, I done it before too! tongue.gif I think the idea is the same though!

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

Reply

faulty.lee
QUOTE(Jimmy89 @ Aug 21 2007, 08:36 PM) *
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) *
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)

Reply

Jimmy89
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)

Reply

Latest Entries

Jimmy89
thanks for that! I will try what you have suggested so far and get back to you with any problems, if you don't mind tongue.gif

Reply


Got an Opinion! Express your Views! (no registration):-
Add your Reply/ Opinion/ Views/ Comments/ Suggestion/ Questions/ Queries etc.
Posts with decent grammar & English will be accepted and please refrain from profanities.
For asking a Question, We recommend you to sign-up (for free) so that you can track the topic easily.

Nature of your Post*: Opinion/ Reply/ Comments
Question/Query
Feedback to us.
       
Name   Email
Title/Question*

Pages: 1, 2
Recent Queries:-
  1. saving text box data to computer vb - 4.20 hr back. (1)
  2. textbox new line vb.net - 13.21 hr back. (1)
  3. esc clearing textbox - 25.46 hr back. (1)
  4. read word file on vb.net - 32.87 hr back. (1)
  5. click put value in text box - 52.34 hr back. (1)
  6. listview to text box - 55.92 hr back. (1)
  7. function that counts in a text box in visual basic - 88.15 hr back. (1)
  8. creating a text box then saving it - 119.82 hr back. (1)
  9. read text box data - 183.93 hr back. (2)
  10. edit text box other program visual basic - 191.32 hr back. (1)
  11. vb.net refresh text box - 192.38 hr back. (1)
  12. value text box php - 226.00 hr back. (1)
  13. how to rotate a text in ms word 2007 - 249.40 hr back. (1)
  14. how to add a line feed in a text box - 278.20 hr back. (2)
Similar Topics

Keywords : updating, values, text, box

  1. Help Rounding Maths Values
    (9)
  2. Vertical Text In Datagridview Column Header
    (6)
    Hi, I don't know how to rotate a text in a DataGridView column header to be written vertically
    from bottom to top. I found a property called GdiVerticalFont in a datagridview
    ColumnHeadersDefaultCellStyle, but it doesn't work. I don't have any experience in
    programming user controls so I hope that someone help me to find a good solution. I would be
    grateful for any tip how to modify an existing control, where to put the code and what to modify.
    Thanks in advance ....
  3. VB.NET: How To Edit & -90degree Rotate Text In Ms Word File ?
    Need reply urgently (3)
    How to open a word file from VB.net? also need to write data in this file with -90 degree rotation.
    just want to add some data in word file through VB.Net but data is needed to be written in -90
    degree rotation format....
  4. Finding The Current Line Number In A Text Box
    A very basic method of doing the deed. (1)
    Language: Visual Basic 6.0 (5.0/4.0) Level: Beginner Problem: How to find the current Line Number
    in a multiline text box? Some times it is necessary for us to provide a text editor in our
    programs, or maybe a text viewer. The text box control has no built in method to find the current
    line number like RichTextBox. Hence we need to code it manually. Solution: The simple concept of
    line numbers is the carriage return character, or simply the ASCII code 10. The line feed character
    has the ASCII code 13. In the code example I have used chr(10), you can also use vbCrLf i....
  5. Visual Basic: Change Your Start Button Text! (XP)
    Windows XP ONLY (16)
    Personally, I love this program I made for myself. What the following code will allow you to do is
    change the text of your start button (Duh). You can make it whatever you want, your name, a hobby,
    or even do some extra programming and get it to randomly cycle through captions every 30 seconds or
    so /smile.gif' border='0' style='vertical-align:middle' alt='smile.gif' /> . Here is all the code
    you'll need: CODE Private Const WM_SETTEXT = &HC Private Const WM_GETTEXT = &HD Private
    Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName ....

    1. Looking for updating, values, text, box






*SIMILAR VIDEOS*
Searching Video's for updating, values, text, box
advertisement




Updating Values In A Text Box