home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.visual.basic      MS Visual Basic discussions, NOT dot-net      10,840 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 10,635 of 10,840   
   Per Juul Larsen to All   
   Re: read and write variables from textfi   
   18 Aug 08 11:00:38   
   
   From: juul@larsen.dk   
      
   Raoul Watson skrev:   
   > Per Juul Larsen wrote:   
   >> Hi.   
   >> My Textfile looks like this   
   >>   
   >> Variable 1   
   >> Variable 2   
   >> Variable 3   
   >> Variable 4   
   >>   
   >> On opening the application it will read the textfile, and assign each   
   >> line of variable to at textfield in VB and then close the file.   
   >> How can I do this   
   >>   
   >   
   > I may be missing something but would this work?   
   >   
   >   
   > Open "yourfile.txt" for input as #3   
   >   
   > input #1, text1.text   
   > input #2, text2.text   
   > input #3, text3.text   
   > input #3, text4.text   
   >   
   > close #3   
   >   
   Thank You   
      
   I saw the light...   
      
   I read line by line until it comes to end of the file like this   
   Dim a, b, c, d   
   Open "C:\users\public\temp\ok.txt" For Input As #1   
      
            While Not EOF(1)   
                Line Input #1, a   
                Text1.Text = a   
                Line Input #1, b   
                Text2.Text = b   
                Line Input #1, c   
                Text3.Text = c   
                Line Input #1, d   
                Text4.Text = d   
      
            Wend   
        Close #1   
      
   regards pjl   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca