Reading settins from .ini line for line

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Skidlz
    New Member
    • Nov 2006
    • 7

    #1

    Reading settins from .ini line for line

    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:
    Code:
    Private Sub Command11_Click()
    Open Text2 For Input As #1
    Text1.Text = Input(LOF(1), #1)
    Close #1
    If Text1 = 1 Then
    Check1 = Checked
    Else
    Check1 = Unchecked
    End If
    End Sub
    Thank You!
  • Skidlz
    New Member
    • Nov 2006
    • 7

    #2
    * actually I'm just going to use a .txt dunno if it matters.

    Comment

    • albertw
      Contributor
      • Oct 2006
      • 267

      #3
      Originally posted by Skidlz
      * 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=II f(Text1.Text="1 ",1,0)

      Comment

      • albertw
        Contributor
        • Oct 2006
        • 267

        #4
        Originally posted by albertw
        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=II f(Text1.Text="1 ",1,0)

        hi

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

        try the next code

        Code:
        Private Sub Form_Load()
        On Error GoTo fail
        Open App.Path & "\settings.txt" For Input As #1
        Line Input #1, v
        p = Split(v, ",")
        Form1.Move p(0), p(1), p(2), p(3)
        Line Input #1, v
        Text1.Text = v
        Line Input #1, v
        Check1.Value = v
        fail:
        Close
        End Sub
        
        Private Sub Form_Unload(Cancel As Integer)
        Open App.Path & "\settings.txt" For Output As #1
        Print #1, Form1.Left; ","; Form1.Top; ","; Form1.Width; ","; Form1.Height
        Print #1, Text1.Text
        Print #1, Check1.Value
        Close #1
        End Sub

        Comment

        • Skidlz
          New Member
          • Nov 2006
          • 7

          #5
          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!

          Comment

          Working...