Page 2 of 2

Re: i need help with setting files .ini

Posted: Thu Mar 17, 2011 9:33 pm
by marve25
ok, thanks

Re: i need help with setting files .ini

Posted: Thu Mar 17, 2011 9:55 pm
by Napster1488
no prob...but next time please more info about what you wonna do and what u need to know

Re: i need help with setting files .ini

Posted: Thu Mar 17, 2011 11:22 pm
by mandai
There is more than enough info given to say what is needed here.
Code: Select all
    Private Sub btnRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRead.Click
        Dim lines As String() = File.ReadAllLines("file.ini")
        For i As Integer = 0 To lines.Length - 1
            If lines(i).StartsWith("Text1=") Then
                TextBox1.Text = lines(i).Remove(0, 6)

            ElseIf lines(i).StartsWith("Text2=") Then
                TextBox2.Text = lines(i).Remove(0, 6)
            End If
        Next
    End Sub

    Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
        Dim content As String = "Text1=" & TextBox1.Text & vbCrLf _
                              & "Text2=" & TextBox2.Text

        File.WriteAllText("file.ini", content)
    End Sub

Re: i need help with setting files .ini

Posted: Fri Mar 18, 2011 1:41 pm
by marve25
Thanks mandai

Re: i need help with setting files .ini

Posted: Sat Mar 19, 2011 9:51 pm
by marve25
Solved