Loading data from a file to text boxs


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Loading data from a file to text boxs

Hybrid View

  1. #1
    Join Date
    May 2005
    Posts
    12

    Loading data from a file to text boxs

    Sorry for the begginers question but i am trying to learn vb and have just got stuck

    I need to load data from a file to 6 text boxs.

    This is the code i have to save the data:

    Code:
    Open "c:\program files\Mikesprogs\MikesLotteryChecker\" & Frame2.Caption & ".ini" For Output As hFile
            Print #hFile, Frame2.Caption
            Print #hFile, Text6.Text
            Print #hFile, Text5.Text
            Print #hFile, Text4.Text
            Print #hFile, Text3.Text
            Print #hFile, Text2.Text
            Print #hFile, Text1.Text
    Text1.Text
        Close hFile
    the output looks like:

    test
    1
    2
    3
    4
    5
    6


    But i need to load this data in to the 6 text box's when the program loads and when the load button is clicked but i cant figure out what code to use!

    If anyone can help i would be very grateful

    Thank you

    Mike

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Just do the opposite of what you're doing to write the file. ;-)

    Dim hFile As Integer
    Dim sText As String

    hFile = FreeFile
    Open "d:\path\filename.ini" For Input As hFile
    Input #hFile, sText ' Frame2.Caption
    Input #hFile, sText
    Text6.Text = sText
    Input #hFile, sText
    Text5.Text = sText
    Input #hFile, sText
    Text4.Text = sText
    Input #hFile, sText
    Text3.Text = sText
    Input #hFile, sText
    Text2.Text = sText
    Input #hFile, sText
    Text1.Text = sText
    Close hFile
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    May 2005
    Posts
    12
    Thank you,

    worked wonders,

    Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center