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 9,492 of 10,840   
   Steve Gerrard to Lance   
   Re: Execute a command read from a file?   
   14 May 05 09:55:58   
   
   From: mynamehere@comcast.net   
      
   "Lance"  wrote in message   
   news:D6ghe.137404$dP1.483869@newsc.telia.net...   
   > Hi All,   
   >   
   > I would like to read commands from a file and execute them in VB, something   
   > like reading str = "hello world" into VB and execute it. Any suggestions   
   > will be appreciated.   
   >   
   > Thanks,   
   > Lance   
   >   
   >   
      
   Try out the often overlooked Microsoft Script Control 1.0, available in your   
   list of components to add to a project. With a script control called SC1 on a   
   form, you can do things like this:   
      
   Private Sub Command1_Click()   
       Dim strCode As String   
      
       strCode = "Sub HelloSub()" & vbNewLine   
       strCode = strCode & "strHello = ""Hello World""" & vbNewLine   
       strCode = strCode & "Msgbox strHello" & vbNewLine   
       strCode = strCode & "End Sub" & vbNewLine   
      
       Debug.Print strCode   
      
       SC1.AddCode strCode   
       SC1.Run "HelloSub"   
      
   End Sub   
      
   --- 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