Re: i need help with setting files .ini
Posted: Thu Mar 17, 2011 9:33 pm
ok, thanks
Sharing, Teaching and Supporting coders of all ages and levels since 2009
https://www.codenstuff.com/forum/
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