VB.NET: n00b question

Lukas

Real Name No Gimmicks
Joined
30 Jan 2002
Messages
421
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
 
Save it to a text file, like you said :D.

Search google as there are many examples available.
 
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 profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,494
Members
5,621
Latest member
naeemsafi
Back