SolvedπŸ‘ Saving/Editing/Removing ComboBox Data

Posts 16–22 of 22 Β· Page 2 of 2
Quote Originally Posted by Cryptonic View Post
I have no idea how you're banned, but if you're not permanently banned, you used this for saving folder locations? And what did you insert the data to, a listbox?
If you still need help, I got you.
Quote Originally Posted by DawgiiStylz View Post

If you still need help, I got you.
I could use it, the code he provided is kinda confusing..
Quote Originally Posted by Cryptonic View Post


I could use it, the code he provided is kinda confusing..
Ok, what do you need help with as of now? What're you trying to do
Well, I'm trying to create a program that will hold data. The full explanation is in op. Basically, I need a method to store data from a combo box so when I restart the program, the data will still be there.

I don't want to use save.settings because when you move/copy the program, the settings get deleted... Unless there's a way around that
Quote Originally Posted by Cryptonic View Post
Well, I'm trying to create a program that will hold data. The full explanation is in op. Basically, I need a method to store data from a combo box so when I restart the program, the data will still be there.

I don't want to use save.settings because when you move/copy the program, the settings get deleted... Unless there's a way around that
Use .xml

Its so simple to use as well!

Create a class and write this:
Code:
 Public _SomeString As String
    Public Sub New(ByVal SomeString As String)
        Me._SomeString = SomeString
 End Sub
'For your case, you'll need to make an array just like this!
To Load,
Code:
Dim fileLoc As String = Application.StartupPath & "\Settings.xml"
    Public Sub LoadSettings()
        If My.Computer.FileSystem.FileExists(fileLoc) Then


            Dim document As XmlReader = New XmlTextReader(fileLoc)
            While (document.Read())
                Dim type = document.NodeType
                If (type = XmlNodeType.Element) Then
                    If (document.Name = "ThisString") Then
                        dim x as string = document.ReadInnerXml.ToString()
                    End If
            End While
            document.Close()
        End If
To write:
Public Sub SaveSettings(ByVal Hallo As String)
Code:
Dim set as New clsInfoSettings(Hallo)




        Dim settings As XmlWriterSettings = New XmlWriterSettings()
        With settings
            .Indent = True
        End With


        Using writer As XmlWriter = XmlWriter.Create(fileLoc, settings)
            With writer
                .WriteStartDocument()
                .WriteStartElement("Program_Settings")
.WriteElementString("ThisString", SomeString)
 .WriteEndElement()
 .WriteEndDocument()
                .Close()
            End With
        End Using


End Sub
You can figure the rest out on ya own. I won't spoon feed anyone
Thanks for the help, though I already recieved help from 1UP. Since you never posted back I thought you wouldn't have bothered. This is good for anyone else that needs it though
//Solved

-VM/PM me if it's not
Posts 16–22 of 22 Β· Page 2 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us