Visual Basic (VB)

  Home  Computer Programming  Visual Basic (VB)


“Visual Basic Interview Questions and Answers will guide you that Visual Basic (VB) is the third-generation event-driven programming language and integrated development environment (IDE) from Microsoft for its COM programming model. By browsing our Visual Basic Interview Questions and Answers you will learn that VB is also considered a relatively easy to learn and use programming language. This VB interview questions and answers guide will make Visual Basic more easy to learn for every one.”



102 Visual Basic (VB) Questions And Answers

101⟩ Hi, sorry but i have a simple question ! i have a string like "2^5+2*5^2-1" in a textbox and i want to have the result of this string in another textbox. but i cant get the answer! i am new and i want to have a function like f(x) = x^5+2*x^2-1 and then i can calculate f(i) for example for i = 0 to 100please help?

I believe that in VB6, there is no facility to calculate maths formula from string. So you need to create a function or your own logic to implement such a calculation.

Here is the code for above question. You can call that function with passing your number.

Function Calc(ByVal intNumber As Integer) As Double

Dim dblResult As Double

dblResult = (intNumber ^ 5) + (2 * (intNumber ^ 2)) - 1

Calc = dblResult

End Function

I hope it helps.

 212 views