Question Locked

Programming in VB2k5 Save Button

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I have a bunch of fields set up (46 text boxes and 23 drop down boxes). I want a user to be able to click a button labled save and the coding to save the textboxes and drop down informaiton in the exact order it is in and create a file name for it. I also want to know if there is a way that I can code a load button so when clicked they can open their project back up. i am new to programming and need help with these two things....the rest of the program runs fine......any help would be appreciated.

3 replies

by scott_heath

I would save the data to a XML file.

You can use the form load event to read the data from the XML file and set the values of the text and drop down boxes.

I'm not sure what you mean by "in the exact order and create a file name for it".

But if I understand correctly you can make XML elements by control name (i.e. TextBox1 or whatever you chose) so it would always put that value back in that control.

Let me know if you need more help than that.

Also check out: http://xmlfiles.com/xml/

Regards,
Scott

http://scottisageek.spaces.live.com

by tony hopkinson

Could be a bad move that. Rejig the form in version 2, and you ned to convert any files froma previous version, or refuse to load them.

There are open aand save dialogs to use to set and get the file.

The form has a controls property, wich is list of all the things on it.

So you could loop through that, test for the classes you use

so TextBox.Text and ComboBox.Items and Selected index. If you use XML

etc

Loading it you just load the file into an XMLDocument Class, rip through it and look for a control of the same name, if you find it set it.

PS Controls is those contained by the form. If you have panels, or some other container.

Forms contains the panel, and panel contains the textbox.

HtHs

This discussion is closed to new replies.