VB.NET: n00b question

Lukas

Real Name No Gimmicks
#1
Hi, I jyst started with VB.NET.

I'm writing a small app. It's my first time so be gentle :p ...

I made a 'configuration'-form, where the user can store some information the program needs. Basically, there are only three textboxes that should store data (hostnames to be exact). Now my question is how do I make my application remember what the user typed into the textboxes?

I can type values into the textboxes, and the app works fine, but it dissapears when I restart my application. I really don't know how to store that 'configuration' so that it will be there when the appliocation starts for a second time.

I don't really want to use an connection to a access database or SQL database, but I need my configuration to be saved INTO my application, textfile, ini-file or xml... and retrieved from that file after the app is restarted.

Can any1 help?



Thnx


Lukas
 

Lukas

Real Name No Gimmicks
#3
Ok,


Now I can write the textfile with this code:


PHP:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
     
    Dim sw As StreamWriter = New StreamWriter("config.txt") 
    sw.WriteLine("HOST1=" + Host1.Text) 
    sw.WriteLine("HOST2=" + Host2.Text) 
    sw.WriteLine("HOST3=" + Host3.Text) 
    sw.Close() 
End Sub
but I don't know how to read specific lines out of it. I need the Host1, Host2 and Host3 textboxes to retrieve the previously typed info from the text file, even when the app is restarted. So the textboxes need to be "bound" to the HOSTx= lines in the textfile.

So:

Host1.Text = config.txt, Line 1
Host2.Text = config.txt, Line 2 and so on...


I looked for it on Google, but I don't exactly know how to build the search query... (means: I don't know what to look for)
 

Members online

No members online now.

Latest posts

Latest profile posts

Perris Calderon wrote on Electronic Punk's profile.
Ep, glad to see you come back and tidy up...did want to ask a one day favor, I want to enhance my resume , was hoping you could make me administrator for a day, if so, take me right off since I won't be here to do anything, and don't know the slightest about the board, but it would be nice putting "served administrator osnn", if can do, THANKS

Been running around Quora lately, luv it there https://tinyurl.com/ycpxl
Electronic Punk wrote on Perris Calderon's profile.
All good still mate?
Hello, is there anybody in there? Just nod if you can hear me ...
Xie
What a long strange trip it's been. =)

Forum statistics

Threads
61,971
Messages
673,300
Members
89,016
Latest member
Poseeut