ThyElite Forums  
Go Back   ThyElite Forums > Downloads > Endorsed & Supported programs
Reload this Page YAWCC v1.6
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
(#18)
Old
DefectiveProduct is Offline
The Best
DefectiveProduct is on a distinguished road
 
Posts: 771
Join Date: Jul 2006
Location: O_o
Default 08-07-2006, 12:24 PM

To save Text1



Quote:
Private Sub WriteConfig
On Error GoTo error
Open "" & App.Path & "\CONFIGNAME.ini" For Output As #1
Print #1, "T=" & Text1.Text & ""
Close #1
Exit Sub

error:
MsgBox "An error occured while writing the config.", vbCritical, "ERROR"
End Sub
To read the config and get the content from it.


Quote:
Private Sub ReadConfig()
On Error GoTo error
If Dir("" & App.Path & "\CONFIGNAME.ini") = "" Then
Exit Sub
End If

LineNum = 0
Open "" & App.Path & "\CONFIGNAME.ini" For Input As #1
Do Until EOF(1)
LineNum = LineNum + 1
Line Input #1, ConfigLine

If ConfigLine Like "T=*" Then
Text1.Text = Right(ConfigLine, Len(ConfigLine) - 2)

Else
End If
Loop

Close #1
Exit Sub

error:
MsgBox "An error occured while reading the config.", vbCritical, "Error"
End Sub
To add a new line of text in your ini file, just insert this small code in the line that prints what you want the file to say.

Quote:
" & vbCrLf & "
So let's say you had three textboxes named Text1, Text2 and Text3.

Quote:
Print #1, "1=" & Text1.Text & vbCrLf & "2=" & Text2.Text & vbCrLf & "3=" & Text3.Text & vbCrLf & ""

To add the reading of another line in the config, add another one of these codes to your ReadConfig function.

Quote:
If ConfigLine Like "(whatever)=*" Then
(whatever).Text = Right(ConfigLine, Len(ConfigLine) - 2)
To write the config, just insert this code in a command button or some other function.

Quote:
WriteConfig
and to read it,

Quote:
ReadConfig
It's kind of complicated but if you just read everything over and look at what is written you can get the hang of it. I'm far too lazy to explain everything piece by piece, so you'll have to just try and figure it out. :|






Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
YAWCC Help liljonx522x Help! 1 08-05-2006 10:38 PM
YAWCC v1.5 DefectiveProduct Programs 19 07-27-2006 01:43 PM



Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.