Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

  • Leaders
Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...