Im a total newbie here.. :)

I have a file in C:\Program Files beta.txt

inside the file beta.txt:
-------------------------------
Line1
LineUser=12345
LinePass=1234
Line4
Line5
--------------------------------

I have two textbox..

Text1 is for LineUser input (fixed to 5 characters)
Text2 is for LinePass input (fixed to 4 charaxters)

Example:
LineUser: [ basic ]
LinePass: [ beta ]

then after clicking Command1, the file is save as
-------------------------------
Line1
LineUser=basic
LinePass=beta
Line4
Line5
--------------------------------
:?:

So what is your problem? Are you trying to figure out how to replace those values? Open the file for Output...

See in VB's help...
FreeFile Function
Open Statement
Line Input or Input Function 'for reading
Print Statement 'for writing
Close Statement

Good Luck

So what is your problem? Are you trying to figure out how to replace those values? Open the file for Output...

See in VB's help...
FreeFile Function
Open Statement
Line Input or Input Function 'for reading
Print Statement 'for writing
Close Statement

Good Luck

Yahh..

I need to change the value 12345..
It will be replaced by the value i entered in the Textbox..

Then save the file..

I think that is no way to replace a certain line in your text file...
Right, probably that have a way (always have), but maybe too hard... ;]


Using the commands vb5prgrmr told you (Open / Line Input / Print / Close) you will be able to:

1. Open your file, for READING;
2. Put EACH line you read in a invisible multiline textbox or in a string variable;
3. Close your file;
4. Open it again, for WRITING;
5. Begin with the first lines... then, when you reach the line "LineUser=..." (you can use InStr function to test if each line matches, or counting lines to the nth. line), simply write the new value you want (like Print #1, "LineUser=" & Text1.Text );
6. Write the other lines without modification (remember you stored these lines in textbox or variable);
7. Close your file.


If you need, try googling "OPEN STATEMENT VB6" or something else to get more help on how to manipulate files. You'll find a lot of examples... The MSDN is a good start, also.


Good luck!
Sidnei

can you please provide some codes..

im a vb6 starter :(

There is example code on this site, on the web, in the help files for VB. You just need to put a little effort forward to find them... BY SEARCHING!!!

Then if you have any problems with your code, post it and tell us what line you are getting your error on, its number, and its description...


Good Luck

I found it :D

thanks guys :)

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.