|Visual Studio C# Windows Form Application|

I'm trying to load and save multiple comboboxes selections to a XML file or file to a specific location using diolog box to know where to save and load.

Any help will be appreciated.

Recommended Answers

All 11 Replies

Q. What are you trying?

We know this is going to take a bit of code but no one can write it for you but in short, you make routines to:

  1. Query those combobox's to some array or such.
  2. Save such to the XML or other format file.
  3. A routine to read the XML or other file and set the boxes to those values.

Im trying to make a application that a user can select an option in each combobox and then click the save button and save the selections to a file or xml whatever is easier and then when they open again they can click a load button and load the file from a specific location and it will pupulate the combo boxes with the options they selected.

That's the goal. But you need to write functions (code) to do this. Can you tell the forum where you are stuck?

I am new to Visual Studio And wanna learn what steps I should do to accomplish the idea. Iv'e tried a few things on youtube but was only able to save the comboboxes selected to a file but don't remeber the video and im just lost any help with a guide will be amazing. Iv'e been trying to research this for the past few days and only seen how to save it to a file but not to a specific location using dialog box to save to a location and then load from a specific location.

You didn't clearly state where you are stuck. You did write " only able to save the comboboxes selected to a file " so I take that as you can examine the objects, save the information to a file.

At this point you need functions to:

  1. Read this file.
  2. Set the objects as you had before.

Since you can write a file, I might bet you can read the file back.

Can I ask why you want this to a file and not My.Settings?

Example: https://www.vbforums.com/showthread.php?848175-My-Settings-save-Combobox-Items

Okay that would be easier, How would I save each combobox to application settings so whatever has been selected in each combobox it will save when the application is reopened in Visual Studio C# Windows Form App

Your last reply, at least to me is a new question. I can't see any reason for the combobox to do this during development (Visual Studio), that is, the app is not running.

Unless I misunderstood your last reply.

Let me start over with a new question
How can I have multiple Comboboxes and the user can select an item from the combobox and when they close the app it will save what they choosen in each Combobox I think that will be alot eaiser for the application I'm making. And the application is being made in Visual Studio Windows Form

Sorry for all the misunderstanding just thought this idea would be better suited for the program I'm making.

Each save can be specific to each object.

Look closely at the example from the link above:
` My.Settings.ComicList.Add(txtdata.Text)'

That ComicList would change name to match each object.

But hey, if you want to do this all in your own code, with files, readers and writers, loaders and savers, that's your choice too.

commented: I'm not using Visual Basic +0

I'll figure it out.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.