Click here to Skip to main content
15,906,569 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Plugins Pin
beowulfagate28-May-04 14:56
beowulfagate28-May-04 14:56 
GeneralWM_GETTEXT from text box. Please Help... Pin
danfloun28-May-04 12:33
danfloun28-May-04 12:33 
Questionhow do you create a .mat file in VB6? Pin
murphypa28-May-04 8:49
murphypa28-May-04 8:49 
AnswerRe: how do you create a .mat file in VB6? Pin
Dave Kreskowiak28-May-04 9:25
mveDave Kreskowiak28-May-04 9:25 
GeneralIs there a general way to check a string... Pin
viettho28-May-04 7:30
viettho28-May-04 7:30 
GeneralRe: Is there a general way to check a string... Pin
Dave Kreskowiak28-May-04 7:44
mveDave Kreskowiak28-May-04 7:44 
GeneralRe: Is there a general way to check a string... Pin
viettho28-May-04 8:36
viettho28-May-04 8:36 
GeneralRe: Is there a general way to check a string... Pin
Dave Kreskowiak28-May-04 9:12
mveDave Kreskowiak28-May-04 9:12 
Let me get this straight... This is your VB.NET code and your trying to do something like this:
'Get some user input and put it in a variable.  Then evaluate the expression...
Dim strInput As String = "Cost = 20 * Quantity / Discount and Cost = 49"
EvaluateUserExpression(strInput)
.
.
.

Public Function EvaluateUserExpression(ByVal strExpression As String) As Boolean
    If strExpression Then
        Return True
    Else
        Return False
    End If
End Function

Now, if I understand you correctly, the Cost, Quantity, and Discount terms are actual variables inside your code. Correct?????

If this is true, then what you want to do can't be done using a simple if statement. You must parse up and validate the expression term-by-term and evaluate it along the way. You would ahve to check to see if the Cost/Quantity/Discount variables exist in your code, handle the equals signs and the operators yourself. You're looking for expression parsing techniques that, if covered in breif, are much too large to be taught over the forums.

Google for 'VB mathematical expression parser' and you'll come up with tons links on various articles, techniques, some source code...


RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

GeneralVBA/Excel - Chart options Pin
Jon G28-May-04 7:19
Jon G28-May-04 7:19 
GeneralRe: VBA/Excel - Chart options Pin
Dave Kreskowiak28-May-04 7:37
mveDave Kreskowiak28-May-04 7:37 
GeneralRe: VBA/Excel - Chart options Pin
Jon G28-May-04 8:09
Jon G28-May-04 8:09 
GeneralRe: VBA/Excel - Chart options Pin
amit2530-May-04 23:11
amit2530-May-04 23:11 
GeneralRe: VBA/Excel - Chart options Pin
Jon G31-May-04 2:31
Jon G31-May-04 2:31 
Generalfile size... Pin
Night_Soul28-May-04 5:10
Night_Soul28-May-04 5:10 
GeneralRe: file size... Pin
Dave Kreskowiak28-May-04 5:55
mveDave Kreskowiak28-May-04 5:55 
GeneralRe: file size... Pin
Night_Soul30-May-04 21:02
Night_Soul30-May-04 21:02 
GeneralRe: file size... Pin
Dave Kreskowiak31-May-04 0:51
mveDave Kreskowiak31-May-04 0:51 
GeneralRe: file size... Pin
Night_Soul31-May-04 2:33
Night_Soul31-May-04 2:33 
GeneralRe: file size... Pin
Serge Lobko-Lobanovsky31-May-04 23:27
Serge Lobko-Lobanovsky31-May-04 23:27 
GeneralRe: file size... Pin
Anonymous7-Jun-04 2:08
Anonymous7-Jun-04 2:08 
GeneralDisable ESC key... Pin
cyberstrategist28-May-04 3:00
cyberstrategist28-May-04 3:00 
GeneralRe: Disable ESC key... Pin
Dave Kreskowiak28-May-04 3:15
mveDave Kreskowiak28-May-04 3:15 
GeneralRe: Disable ESC key... Pin
Night_Soul28-May-04 5:16
Night_Soul28-May-04 5:16 
GeneralRe: Disable ESC key... Pin
Dave Kreskowiak28-May-04 5:44
mveDave Kreskowiak28-May-04 5:44 
GeneralRe: Disable ESC key... Pin
Night_Soul30-May-04 20:45
Night_Soul30-May-04 20:45 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.