Need help with 2-3 things

Posts 1–10 of 10 · Page 1 of 1
Need help with 2-3 things
hey , i am new on VB .
listen , i need help with a lot of things .

okay so i start .

1)how i save the textbox1 text in .cfg or .txt file in the folder of the program ? .

2)how i create a .INI file that save my things from the textbox and when i want to get things from there its will be work ?
like if i click on YES button its will be write in .INI file:
button1=YES
and how i can get this infromation if i click in another button ?
i mean when i click button 2 its change the label1.text text to YES or what inside in the INI file .. ?

edit:
3)how i get "Detection" of the folder like to Black-ops steam folder and save the .txt file in there ?

sory for bad english ..

Thanks for helpers .
3. Registry keys.
Quote Originally Posted by wezljkz View Post
thanks ..but to 1 queasion have anytihng else ?

uh ?
When you install a program, generally it has some of its info stored in a registry key, so you need to find where in the registry BlackOps info is, then what the info name of the install path is, after that you can just use VB's Registry class to pull the value at that location and voila, you have the install path.
Quote Originally Posted by wezljkz View Post
thanks ..but to 1 queasion have anytihng else ?
Why? you can rename the file the way you want. "MyProgram.cfg", "Haxhaxhax.ini" or whatever
Quote Originally Posted by Jason View Post


When you install a program, generally it has some of its info stored in a registry key, so you need to find where in the registry BlackOps info is, then what the info name of the install path is, after that you can just use VB's Registry class to pull the value at that location and voila, you have the install path.
oh no no no that not what i mean .
i mean that you need to put your path to the folder .. you will decide where to put the .cfg file .
and more one thing :\ about the .ini file tutorial
how i do that if you Checked yes in checkbox1 that will put in .file something like:
checkbox1=youcheckedyes that i mean that you can put everything that you want if you checked yes and if it not so it will do the else of thing .

i do that:
Code:
        If inifile.ReadValue("General", "Box2", chkBox2.Checked) = True Then
            inifile.WriteValue("General", "Text", "cool")
        Else
            inifile.WriteValue("General", "Text", "notcool")
        End If
but its too big .. need something more small ..
you can try this TO save textbox in vb6

Code:
Dim fnum As Integer

fnum = FreeFile
    Open App.Path & "\config.ini" For Output As fnum
   
   Write #fnum, Text1.Text
    
    Close fnum
To load:

Code:
Dim fnum As Integer
Dim txt As String
fnum = FreeFile
Open App.Path & "\config.ini" For Input As fnum

 Input #fnum, txt
    Text1.Text = txt

Close fnum
Write a .txt or .cfg file:

Code:
Dim Writer As New IO.StreamWriter(Application.StartupPath & "/textfile.txt") ' If you want cfg just change .txt to .cfg
Writer.Write(Textbox1.Text)
Writer.Close

Check if a folder exists:
Code:
If IO.Directory.Exists("PATH") Then
Msgbox("THe folder exists!") ' Or whatever

Else

Msgbox("The folder doesnt exists!") ' Or whatever
        End If
I'm kinda confsused on the reading myself...

If it put

Code:
 My.Computer.FileSystem.ReadAllText("C:\FD.txt")
        TextBox1.Text = ("C\FD.txt")
NVM, its

Code:
TextBox1.Text = My.Computer.FileSystem.ReadAllText("C:\FD.txt")
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us