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,174 of 10,840   
   Martin to Steve Gerrard   
   Re: text box calculation   
   26 Jan 05 15:54:40   
   
   From: cadoss@btconnect.com   
      
   Many thanks for the tip Steve, it works a dream.   
      
   Regards   
      
   Martin   
      
   "Steve Gerrard"  wrote in message   
   news:oeWdnYdvTtcSuW_cRVn-gw@comcast.com...   
   >   
   > "Amanda"  wrote in message   
   > news:41f131ce_2@mk-nntp-2.news.uk.tiscali.com...   
   > | Help,   
   > |   
   > |  I am new to visual basic programming and I was wondering how to allow   
   > a   
   > | textbox   
   > | to do a calculation by pressing enter   
   > |   
   > | ie I want to type the following into a textbox  25.2 * 2  press enter   
   > on the   
   > | keyboard   
   > | and the textbox to display 50.4   Any Ideas ???????   
   > |   
   > |   
   >   
   > Do you have the Microsoft Script Control in your list of components? If   
   > so, then add one to your form. You then just need this simple event   
   > handler:   
   >   
   > Private Sub Text1_KeyPress(KeyAscii As Integer)   
   >     If KeyAscii = vbKeyReturn Then   
   >         On Error Resume Next   
   >         Text1.Text = ScriptControl1.Eval(Text1.Text)   
   >     End If   
   > End Sub   
   >   
   > You might want to make Text1 multi-line, so you don't get a beep when   
   > you press enter.   
   >   
   >   
      
   --- 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