Sinisterly
[HELP]Adding code from outside - Printable Version

+- Sinisterly (https://sinister.ly)
+-- Forum: Coding (https://sinister.ly/Forum-Coding)
+--- Forum: Visual Basic & .NET Framework (https://sinister.ly/Forum-Visual-Basic-NET-Framework)
+--- Thread: [HELP]Adding code from outside (/Thread-HELP-Adding-code-from-outside)



[HELP]Adding code from outside - 1llusion - 02-07-2011

Hi Smile
I didn't know how to name it, so I tried this title Smile Biggrin

Well... I have this little idea of a math problem brute-forcer.
I was thinking about it how I would do it and I faced a problem.

How can I do in VB that it will count something, what user inputs?

Example: The program has just 1 button: Calculate. And some textbox, I have the feeling I will need richtextbox for thisTongue

Anyway, the user will write in the textbox: 1 + 1 and he hits calculate, the program will return "2"

It should work for any math operation: (1 + 1) * ( 2 - 1)
(4 - 1) / 2..........


Thanks a lot!!!

Have a nice day!!!!


RE: [HELP]Adding code from outside - Coder-san - 02-07-2011

Lol, you won't believe me but I was thinking about making this 2 days ago. I've formatted and switched to 7-64bit, so wait for me to install stuff and test the code I have in mind.


RE: [HELP]Adding code from outside - 1llusion - 02-07-2011

(02-07-2011, 12:14 PM)Coder-san Wrote: Lol, you won't believe me but I was thinking about making this 2 days ago. I've formatted and switched to 7-64bit, so wait for me to install stuff and test the code I have in mind.

yay my mind-set is coming near to a pro Tongue (a wish)

I tried to fool the program by adding " -code- but ofc it doesn't work...

Thanks Smile meanwhile I'll try to come up with something too Tongue


RE: [HELP]Adding code from outside - Coder-san - 02-08-2011

Couldn't test yet, but the other code I tested in VB6 suggest that what I thought probably won't work.
I was trying to reconstruct what Msgbox does.

For example if you enter this:

MsgBox((2+2) * (90-80))

you will get 40.
However it seems tricky to reconstruct. Good luck with your method though.


RE: [HELP]Adding code from outside - 1llusion - 02-08-2011

(02-08-2011, 05:52 PM)Coder-san Wrote: Couldn't test yet, but the other code I tested in VB6 suggest that what I thought probably won't work.
I was trying to reconstruct what Msgbox does.

For example if you enter this:

MsgBox((2+2) * (90-80))

you will get 40.
However it seems tricky to reconstruct. Good luck with your method though.

I was reading a bit about it and it seems to be very difficult for managed language... and if it would be done, it would be more like a compiler then application...

I will try to mix it with lua, since lua can calculate with strings that contain only numbers etc...
But I'm not so sure how you call lua from vb Biggrin

thanks tho Smile


RE: [HELP]Adding code from outside - Coder-san - 02-09-2011

I found this C# code on Stack Overflow:

Code:
var result = new DataTable().Compute("2-3/4*12", null);

VB code should be:

Code:
Dim result As Double = New DataTable.Compute("2-3/4*12", null)



RE: [HELP]Adding code from outside - 1llusion - 02-09-2011

(02-09-2011, 08:54 AM)Coder-san Wrote: I found this C# code on Stack Overflow:

Code:
var result = new DataTable().Compute("2-3/4*12", null);

VB code should be:

Code:
Dim result As Double = New DataTable.Compute("2-3/4*12", null)

wow awesome!!! Thanks!!!