By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,646 Members | 2,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,646 IT Pros & Developers. It's quick & easy.

Reading settins from .ini line for line

P: 7
I need some help with a VB6 settings loader. I need to read text off all the lines but I only know how to do one. I am hoping to change a textbox, a checkbox and possibly the size/position of the main form.
I am using this:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command11_Click()
  2. Open Text2 For Input As #1
  3. Text1.Text = Input(LOF(1), #1)
  4. Close #1
  5. If Text1 = 1 Then
  6. Check1 = Checked
  7. Else
  8. Check1 = Unchecked
  9. End If
  10. End Sub
Thank You!
Nov 18 '06 #1
Share this Question
Share on Google+
4 Replies


P: 7
* actually I'm just going to use a .txt dunno if it matters.
Nov 18 '06 #2

100+
P: 267
* actually I'm just going to use a .txt dunno if it matters.
hi

i don't know what you are trying to achieve with your code.

Private Sub Command11_Click()
Open Text2 For Input As #1
Text1.Text = Input(LOF(1), #1)
Close #1

you want the length of the file Text2 to be put into Text1?

Open text2 For Input As #1
Text1.Text = LOF(1)
Close #1


If Text1 = 1 Then
Check1 = Checked
Else
Check1 = Unchecked
End If

if Text1.Text=1 then check Check1?

Check1.Value=IIf(Text1.Text="1",1,0)
Nov 18 '06 #3

100+
P: 267
hi

i don't know what you are trying to achieve with your code.

Private Sub Command11_Click()
Open Text2 For Input As #1
Text1.Text = Input(LOF(1), #1)
Close #1

you want the length of the file Text2 to be put into Text1?

Open text2 For Input As #1
Text1.Text = LOF(1)
Close #1


If Text1 = 1 Then
Check1 = Checked
Else
Check1 = Unchecked
End If

if Text1.Text=1 then check Check1?

Check1.Value=IIf(Text1.Text="1",1,0)

hi

create a form = Form1
put a textbox Text1
and a checkbox Check1

try the next code

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Form_Load()
  3. On Error GoTo fail
  4. Open App.Path & "\settings.txt" For Input As #1
  5. Line Input #1, v
  6. p = Split(v, ",")
  7. Form1.Move p(0), p(1), p(2), p(3)
  8. Line Input #1, v
  9. Text1.Text = v
  10. Line Input #1, v
  11. Check1.Value = v
  12. fail:
  13. Close
  14. End Sub
  15.  
  16. Private Sub Form_Unload(Cancel As Integer)
  17. Open App.Path & "\settings.txt" For Output As #1
  18. Print #1, Form1.Left; ","; Form1.Top; ","; Form1.Width; ","; Form1.Height
  19. Print #1, Text1.Text
  20. Print #1, Check1.Value
  21. Close #1
  22. End Sub
  23.  
  24.  
Nov 18 '06 #4

P: 7
Yes that works! I am very new/bad at VB and a simple If was the only way I could figure to check the checkbox.

Thank You!
Nov 18 '06 #5

Post your reply

Sign in to post your reply or Sign up for a free account.