PDA

View Full Version : تبدیل رشته به اعداد و اعمال ریاضی



PrinceDotNet
سه شنبه 19 مهر 1384, 15:42 عصر
با چه تابعی باید این کار را کرد.

Hamedm
سه شنبه 19 مهر 1384, 16:02 عصر
سلام

CType(expression, typename)


Parts



expressionAny valid expression. If the value of expression is outside the range allowed by typename, an error occurs.typenameAny expression that is legal within an As clause in a Dim statement, that is, the name of any data type, object, structure, class, or interface.

Remarks




CType is compiled inline, meaning the conversion code is part of the code that evaluates the expression. Execution is faster because there is no call to a procedure to accomplish the conversion.



Example




This example uses the CType function to convert an expression to the specified data type.

Dim MyNumber As Long
Dim MyNewType As Single
MyNumber = 1000
MyNewType = CType(MyNumber,Single) ' MyNewType is set to 1000.0.

برای تبدیل Text به اعمال ریاضی، خودت باید برنامشو بنویسی.

در پناه حق موفق باشید و پرتوان

PrinceDotNet
چهارشنبه 20 مهر 1384, 16:14 عصر
ممنون
اما منطور من این نبود .

بطور مثال (2 + 4) که این بصورت رشته است و میخوام اونو ÷ردازش کنه.

Hamedm
چهارشنبه 20 مهر 1384, 16:49 عصر
سلام


بطور مثال (2 + 4) که این بصورت رشته است و میخوام اونو ÷ردازش کنه.

برای تبدیل Text به اعمال ریاضی، خودت باید برنامشو بنویسی.

در پناه حق موفق باشید و پرتوان