wrxdriven Posted October 28, 2003 Posted October 28, 2003 I ahve a windows for that i want to start up and fill in text boxs with a default . Here is my file it is a .cfg file. [schedule] loan=250000 interest=4.25 years=30 payment=1229.85 HTML=c:\syst2010\schedule.html I want it to read line by line into my text boxes such as loan=250000 goes into the Loan txt box. Please help me... thanks Quote
Leaders dynamic_sysop Posted October 28, 2003 Leaders Posted October 28, 2003 something like this maybe ... Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim sReader As IO.StreamReader '///use the System.IO.StreamReader / System.IO.StreamWriter rather than the FreeFile method. Dim path As String = "C:\myFile.txt" Dim sLine As String Try sReader = New IO.StreamReader(New IO.FileStream(path, IO.FileMode.Open)) While Not sReader.Peek sLine = sReader.ReadLine Select Case sLine.Split("=")(0) '/// the text to the left of the = symbol. Case "loan" MessageBox.Show(sLine.Split("=")(1)) '/// the value at the right of the = symbol. '/// do what you want to the value ( eg: add to textbox called Loan ) Case "interest" MessageBox.Show(sLine.Split("=")(1)) '/// and so on... End Select End While sReader.Close() Catch ex As Exception MessageBox.Show(ex.Message) End Try End Sub Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.