473,671 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I get the answer of a string formula?

12 New Member
Hi,

In the user input of a textbox I would like that the user can input a formula to make it easier for him. So instead of inputing 400 I would like the user to have the possibility to input as 8*50. Is there a command for vb2008 to calculate the answer of this formula inputed by a string ?

Thanks in advance.
Mar 13 '09 #1
4 1624
aryanbs
42 New Member
Dim SControl = CreateObject("S criptControl")
SControl.langua ge = "VBScript"
MessageBox.Show (SControl.eval( "8*50"))
Mar 13 '09 #2
Alfredo73
12 New Member
Great !
Thank you very much. This is exactly what I was looking for. On other forums I found older versions which used difficult scripts to split all the parts.

Is there also a way to make commands from strings?
For example like
DIM textboxnr as string = "textbox5"
textboxnr.text = "Hallo"
To explain it maybe a little better, can I replace the textboxnr by a variable ?
Mar 13 '09 #3
aryanbs
42 New Member
No Its not possible, but you can use through container, like if you have textbox in a form then

Me.Controls(var iablename).Text

If its in a panel in a form then
Me.Panel1.Contr ols(variablenam e).Text

etc
Mar 14 '09 #4
Alfredo73
12 New Member
Great, thank you very much.
Mar 14 '09 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1995
by: Bob Murdoch | last post by:
I have a situation where I call a COM object from ASP that is supposed to create a file. On occasion, especially during development, the output of the COM function is an error string rather than the file name. I'd like to display this error string, regardless of it's contents. Right now, depending on the error string, I get an error message about missing a semicolon or some such. I've tried using Encode and Server.HTMLEncode with no...
3
3320
by: Max | last post by:
Hi, I am trying to convert string entered in a field to uppercase using its formula property. I know it can be done using trigger but still I want to use formula property to achieve the same. Any help will be greatly appreciated. -Max
1
2676
by: Dim | last post by:
Hi, need some help/idea... I have data table in Excel(about 30 columns) and it's getting too big (over 65K) so I need to move it to DB (MS Access is the choice) one of the columns (for example column1 in DataTable has a string (for example AAA, ABC or BCA, etc) and i also have lookup table in excel with formulas which contains a business rule for one of the columns (column35) on how to calculate: for example for AAA the calculation would...
5
26348
by: VM | last post by:
If I have a string variable with a formula: string sMyformula = "3.3*5.2*5"; How can I convert this to a mathematical formula that the compiler can calculate? For all purposes, the formula in the string will always be valid. Thanks
3
5162
by: SiewSa | last post by:
I have come to a situation that I need to use the result of a string variable as a formula for performing calculation. As an example below: Dim X As Integer Dim Y As Integer Dim Result As Integer
4
10696
by: Wade | last post by:
Hi guys, I am building a string in code that is a mathematical formula, based on a lot of criteria specified by the user. Once the formula is complete, I want to evaluate it to get a result. For example: dim strFormula as String strFormula = "((2 + 2) * 3) / 4) - 5"
0
1104
by: jonefer | last post by:
Basic Syntax: I have a formula that needs to return "N/A" or a date. So the formula returns string where I am stuck is what is the equivalent of (MS Access) Format(, "mm/dd/yyyy") because the string my formula returns always has the time in it too and I want only the "mm/dd/yyyy" portion of the date in my string.
3
1790
by: sernamar | last post by:
Hi, I have the following base class class UnitOfMeasure { public: //... std::string& GetName() {return _uomName;}; //... protected:
3
2040
by: Reshmi Jacob | last post by:
Hello..... In my program I have 3 variables, say a = 10 b = 20 c = 30 I have a variable as string
0
8472
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8390
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8909
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8596
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8667
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6222
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4399
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.