|






|
Question
| From: |
John Corbett |
| Date: |
Wednesday 04 April 2001 2:49 PM |
| Subject: |
RE: |
| Question: |
Any codes for designing a scientific calculater in
VB6?
Thank you. |
There are the Sin()
(sine), Cos()
(cosine), Tan()
(tangent) and Log() (logarithm) functions that you could use. E.g:
|
var1 =
Sin(1.45)
var1 =
var2 ^ 2 ' X²
var1 = 10
^ var2 '10^x
var1 =
var2 ^ var3
'x^y
var1 =
var2 ^ (1 / var3)
'x^1/y |
If I have missed something out, tell me what and I will try and
find out how it works.
Comments
| From: |
bluephoenix |
| Date: |
Thursday, January 3, 2008 at 09:56:54 |
| Comments: |
hi...thanks a lot...i've got my backspace work because of this site. .
. |
| From: |
Aaron |
| Date: |
Friday, October 19, 2007 at 03:10:23 |
| Comments: |
lol i tried to use the inverse functions, but they just dont match the
results i get from a calculator... i mean arcsin(0.5) should be 30, but i
keep getting something like 0.4 or some decimal... and its never over 1
O_o can u tell me whats wrong??? ty~ |
| Reply: |
The following code should help you to work out sine and inverse sine.
First, create two buttons - cmdSine and cmdInvSine and then enter the
following code:
Dim pi As
Double
Private Sub Form_Load()
pi = 4 * Atn(1)
End Sub
Private Sub cmdSine_Click()
x = 30
x = x * pi / 180
x = Sin(x)
Debug.Print
x
End Sub
Private Sub cmdInvSine_Click()
x = 0.5
x = Atn(x / Sqr(-x * x + 1))
x = x * 180 / pi
Debug.Print
x
End Sub |
Pi is calculated in Form_Load. As mentioned in the MSDN library:
The Sin function takes an angle and returns the ratio of two
sides of a right triangle. The ratio is the length of the side opposite
the angle divided by the length of the hypotenuse.
The result lies in the range -1 to 1.
To convert degrees to radians, multiply degrees by pi/180. To
convert radians to degrees, multiply radians by 180/pi.
Therefore, to get the same result as a calculator for the Sin function,
the number must first be converted into radians by multiplying it by pi
and then dividing by 180.
For inverse sine, the result of the function from the 'Derived Math
Functions' page of the MSDN library for calculating inverse sine must be
multiplied by 180 and then divided by pi.
The Cos and Tan functions should work in the same way and inversely by
using the appropriate function from the 'Derived Math Functions' page of
the MSDN library (see further down this page). |
| From: |
ronnan padawan |
| Date: |
Wednesday, October 3, 2007 at 05:07:11 |
| Comments: |
the presentation of codings are well implemented and easy to understan |
| From: |
Jan |
| Date: |
Thursday, April 19, 2007 at 05:56:35 |
| Comments: |
Hopefully this will work for me. Thanks for your informtin and sharing |
| From: |
Jazn |
| Date: |
Thursday, March 1, 2007 at 07:16:49 |
| Comments: |
your site is really cool!it really helped me to do my scientific calculator. thanks for the functionS! |
| From: |
suresh kumar jetty |
| Date: |
Monday, February 5, 2007 at 08:32:19 |
| Comments: |
its a nic e and simple way to learn the important codes. |
| From: |
me |
| Date: |
Monday, January 8, 2007 at 23:45:50 |
| Comments: |
i was realllly hoping that i could use a calculater on yhis website. im in a hurry so i have to do my hw now! i didnt bring my scientific calculater home with me!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!poooo! |
| Reply: |
You need Visual Basic 6.0 to be able to open the calculator projects.
|
| From: |
Vahid |
| Date: |
Tuesday, January 2, 2007 at 19:17:57 |
| Comments: |
very exellent your site.
|
| From: |
<vb>newbie |
| Date: |
Tuesday, November 7, 2006 at 07:14:40 |
| Comments: |
this is a cool site for us vb starters... tnx to the author of this site..
|
| From: |
Jane |
| Date: |
Saturday, July 8, 2006 at 10:00:46 |
| Comments: |
I'm so glad that I did have visited your website....It really help me somehow....Tnx!
|
| From: |
shailendra <shailendra_pgdca@reddiffmail> |
| Date: |
Monday, June 5, 2006 at 15:32:34 |
| Comments: |
Clipboard.Clear
Clipboard.SetText txtDisplay.Text 'change to
whatever the display control is |
|
| From: |
Sifelani Mupatule |
| Date: |
Wednesday, May 17, 2006 at 17:44:34 |
| Comments: |
The self explanatory code has helped me a lot for my project pliz keep it up. Pli try to send me other codes. You a star.
|
| From: |
Rudzani |
| Date: |
Friday, April 21, 2006 at 10:15:43 |
| Comments: |
your site is very helpful.May you send me a scientific calculator using Visual Basic 6.0.
|
| From: |
Draik |
| Date: |
Wednesday, April 19, 2006 at 18:43:55 |
| Comments: |
Thank you for the Calculators, I used some of the codes
for my oun calculator, I hope you don't mind,
Thanks Alot Man.
Lord Draik
|
| From: |
Kiki |
| Date: |
Wednesday, April 12, 2006 at 21:57:16 |
| Comments: |
this is very interesting info i'm so glad i found this web site |
| From: |
elekanyani |
| Date: |
Tuesday, April 4, 2006 at 11:46:36 |
| Comments: |
i like the way you give your explanation.for the sake of people like me could you give the code of a standard calculator using visual basic 6.0 in microsoft word as we don't have visual basic in my PC |
| Reply: |
Here is the document. A picture of the Form is included at the
beginning.

vb_12_calc.doc (39.5 KB)
|
| From: |
jupet na malupit |
| Date: |
Friday, January 7, 2005 at 06:12:54 |
| Comments: |
youre are too simple but it helps me up to make my own program next time i will become a computer wizard.......... |
| From: |
sangee |
| Date: |
Thursday, March 4, 2004 at 14:28:08 |
| Comments: |
i dont that the calculator has follow same priority.i want the program that has brackets for priority. |
| From: |
guada,sherly,ema and lea |
| Date: |
Monday, March 1, 2004 at 04:16:27 |
| Comments: |
pls help us with our final requirement in infotech...
Final Requirement in Info Tech. we have been researching but do not have the idea about the codes.. and imagine we're going to submit ti this week.. here's the
problem..thnx!
1. Create a program that will execute the calculator as shown below. Instead of the basic mathematical operators shown in the calculator below, change them to calculate square root, and conversions to hexadecimal and octal, and the factorial.
2. The program uses arrays, specifically using index for the buttons of numbers, index for the buttons of the square root, hexadecimal and octal, and the factorial.
3. The edit menu is left not to function.
4. The calculator can be executed at the desktop.
|
| From: |
otep |
| Date: |
Thursday, February 26, 2004 at 16:21:20 |
| Comments: |
can u give me an example of a calculator program in visual basic that can solve functions and can evaluate it such as -> x+y+27=0, given: f(x)=3... something like this, and also can solve quadratic equations and also codes on how to create a graph out of an equation... pls. i really nid it ASAP coz the deadline of our project is 2 weeks from now and I still dont know how to create one... THANKS.. |
| From: |
kristine |
| Date: |
Wednesday, February 18, 2004 at 17:24:05 |
| Comments: |
will you plz help me with the codings of tangent,squre root,cube root,x cube,x squared and the tan-1...plz rep asap and kindly explain to me what are the meaning of them..and what is the meaning of calcmen?plz help me for my project that will be pass this friday..thanks... |
| From: |
rosemarie |
| Date: |
Thursday, February 12, 2004 at 09:43:16 |
| Comments: |
thank you for the info.about the source code of calculator.
but i think you a lot more to developed this code....
thamks again |
| From: |
shaneez |
| Date: |
Wednesday, February 4, 2004 at 18:37:49 |
| Comments: |
i want to make a scientific calculator in vb.
it should be able to do dy by dx annd factorial .
can you sent me sample program
thank you
bye |
| From: |
bala & vijay |
| Date: |
Friday, January 16, 2004 at 09:32:28 |
| Comments: |
Thank u for ur vb calc program |
| From: |
Azy |
| Date: |
Tuesday, December 9, 2003 at 12:27:43 |
| Comments: |
For my Calculator project, what kind of code will i enter to copy the number. |
| Reply: |
If you want to copy it to the clipboard, try this code:
Clipboard.Clear
Clipboard.SetText txtDisplay.Text 'change
to whatever the display control is |
|
| From: |
Andrew |
| Date: |
Monday, December 1, 2003 at 23:02:26 |
| Comments: |
Can you help me I cannot work out the the code for to convert a number in to Binary and into Hex can any one help
me with this problem |
| From: |
joana |
| Date: |
Tuesday, November 25, 2003 at 21:38:45 |
| Comments: |
i want to make calculator by vb i trid more & more its difficult but i have it homowork ineed help pleas........... |
| From: |
edward |
| Date: |
Friday, November 21, 2003 at 08:10:03 |
| Comments: |
im doing a scientific calculator and a program.... can u pleas e help me in this calculation the formula is X raise to the y for example how can 3 raise 0.387 function? please help me ASAP i have to finished dis progrm thank |
| Reply: |
Use the exponentiation character - '^' e.g.:
|
| From: |
wilai |
| Date: |
Wednesday, November 12, 2003 at 14:09:45 |
| Comments: |
A program Code change hex to dec,dec to hex,dec to bin,bin to dec, oct to dec ,dec to oct and calculate square root
Thank you very much |
| Reply: |
You can use the Int, Hex and Oct functions for this.
|
| From: |
nikhil <engg_nikhil84> |
| Date: |
Monday, October 20, 2003 at 14:55:16 |
| Comments: |
thanks |
| From: |
razia |
| Date: |
Wednesday, October 15, 2003 at 18:14:57 |
| Comments: |
sir
i have to make a scientific calculator.but i dont know about its oprator.so please sir help me in this matter. |
| From: |
hassan |
| Date: |
Monday, September 15, 2003 at 08:58:37 |
| Comments: |
hello brother...i found this wonderful cal code...i thought you would like to see it...i love you |
| From: |
james |
| Date: |
Friday, September 12, 2003 at 05:04:27 |
| Comments: |
what function can i formulate to get the Arctan and arcos? |
| Reply: |
The following is available from the MSDN Library and should help you:
The following is a list of nonintrinsic math functions that can be derived from the intrinsic math functions:
| Function |
Derived equivalents |
| Secant |
Sec(X) = 1 / Cos(X) |
| Cosecant |
Cosec(X) = 1 / Sin(X) |
| Cotangent |
Cotan(X) = 1 / Tan(X) |
| Inverse Sine |
Arcsin(X) = Atn(X / Sqr(-X * X + 1)) |
| Inverse Cosine |
Arccos(X) = Atn(-X / Sqr(-X * X + 1)) + 2 * Atn(1) |
| Inverse Secant |
Arcsec(X) = Atn(X / Sqr(X * X – 1)) + Sgn((X) – 1) * (2 * Atn(1)) |
| Inverse Cosecant |
Arccosec(X) = Atn(X / Sqr(X * X - 1)) + (Sgn(X) – 1) * (2 * Atn(1)) |
| Inverse Cotangent |
Arccotan(X) = Atn(X) + 2 * Atn(1) |
| Hyperbolic Sine |
HSin(X) = (Exp(X) – Exp(-X)) / 2 |
| Hyperbolic Cosine |
HCos(X) = (Exp(X) + Exp(-X)) / 2 |
| Hyperbolic Tangent |
HTan(X) = (Exp(X) – Exp(-X)) / (Exp(X) + Exp(-X)) |
| Hyperbolic Secant |
HSec(X) = 2 / (Exp(X) + Exp(-X)) |
| Hyperbolic Cosecant |
HCosec(X) = 2 / (Exp(X) – Exp(-X)) |
| Hyperbolic Cotangent |
HCotan(X) = (Exp(X) + Exp(-X)) / (Exp(X) – Exp(-X)) |
| Inverse Hyperbolic Sine |
HArcsin(X) = Log(X + Sqr(X * X + 1)) |
| Inverse Hyperbolic Cosine |
HArccos(X) = Log(X + Sqr(X * X – 1)) |
| Inverse Hyperbolic Tangent |
HArctan(X) = Log((1 + X) / (1 – X)) / 2 |
| Inverse Hyperbolic Secant |
HArcsec(X) = Log((Sqr(-X * X + 1) + 1) / X) |
| Inverse Hyperbolic Cosecant |
HArccosec(X) = Log((Sgn(X) * Sqr(X * X + 1) + 1) / X) |
| Inverse Hyperbolic Cotangent |
HArccotan(X) = Log((X + 1) / (X – 1)) / 2 |
| Logarithm to base N |
LogN(X) = Log(X) / Log(N) |
You can see the above here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vagrpderivedmath.asp
|
| From: |
sara |
| Date: |
Thursday, September 11, 2003 at 09:57:27 |
| Comments: |
the page is very helpful but can u please send a simpler or beginners version for calculator.Not like the one that is given here cos i am not being able to understand what is lastinput= "NUMS" and lastinput ="NEG" y is it used please do explain i am new comer to vb |
| Reply: |
The LastInput variable in the Standard calculator project is used to hold
what the last button pressed was. "NUMS" means a numerical
key was last pressed and "NEG" means the minus key was last
pressed.
|
| From: |
Jenny |
| Date: |
Friday, September 5, 2003 at 11:08:50 |
| Comments: |
hi! i really love math and i got 92 in our math subject by the help of scientific calculater but i have some problem i dont know what is the meaning of In in scientific
calculater. |
| From: |
ana may |
| Date: |
Tuesday, September 2, 2003 at 05:11:46 |
| Comments: |
please show me how to make the calculator as dec hex oct.please i really need it in makng my project |
| Reply: |
Please see the following table for conversion between normal,
hexadecimal and octal numbers:
| Number type |
Function |
Number format |
| Normal |
Int() |
16 |
| Hexadecimal |
Hex() |
&HF |
| Octal |
Oct() |
&O20 |
For example, if you wanted to convert a hexadecimal number to an
octal number, you would use the following code:
| var1 = Oct(&HB7) 'returns &O267 as
267 |
|
| From: |
hazel <baby_hazel> |
| Date: |
Saturday, August 30, 2003 at 05:38:26 |
| Comments: |
more info |
| From: |
tina |
| Date: |
Thursday, August 28, 2003 at 20:34:43 |
| Comments: |
well...ppl..ill b really glad if u help with the code in designing a scientific calculator..only with..binary complement,xor,+ and - in vb6.0
plz help guys! |
| From: |
Kyanne |
| Date: |
Friday, July 18, 2003 at 03:05:49 |
| Comments: |
I am trying to write code for a calculator. I cannot get the add button to add properly.
I looked at the sample program and I am not using a control array (Not doing an array at all).
Help |
| From: |
Maichelly Lee |
| Date: |
Monday, July 7, 2003 at 07:52:31 |
| Comments: |
to find how a scientific calculator can help in solving number system arimeties calculations? |
| From: |
khamlijy rachid |
| Date: |
Thursday, June 12, 2003 at 20:39:20 |
| Comments: |
MORE INFO PLEASE |
| From: |
Ryan |
| Date: |
Friday, June 6, 2003 at 19:48:56 |
| Comments: |
Hello,
Im building a Scientific Calculator for my tech class and need help on making a 1/X button.
Can anyone help me? |
| Reply: |
1/X means 1 divided by X. This can be done with this code:
| txtDisplay.Text = 1 / txtDisplay.Text 'change
to whatever the display control is |
|
| From: |
melisa |
| Date: |
Monday, June 2, 2003 at 16:08:34 |
| Comments: |
i really, really need help designing a calculator for my visual basic class. it's a regular four function calculator, but it also has the trig functions and square root. i need help cuz i don't know what the hell i'm doing and this damn thing is due next monday. help! |
| From: |
Tom |
| Date: |
Monday, June 2, 2003 at 00:02:07 |
| Comments: |
I need a code for calclautor like the calclautor in windows system .. I mean that I can use the keyboard or I can write 1 + 1 in the result screen then I press Enter >> the result will be 2 |
| From: |
Sachin |
| Date: |
Wednesday, April 30, 2003 at 23:23:23 |
| Comments: |
Can u Pls help me out with the Shanon and Nyquist Calculator program in Visual Basic.
The formula is
C= W*log2(1+SNR)
R=B*log2M <= 2W*log2M |
| From: |
ira |
| Date: |
Saturday, March 29, 2003 at 09:23:34 |
| Comments: |
hello... this article of urs is very nice... by the way i need some help i have a research project given by out proffesor about the visual basic 6.0 virsion and he wanted us to make a code for a basic calculator could u please help me... thank u so much... the basic calculato would have addition subtraction divission and multiplication functions only i do really apprecial the help thank u |
| From: |
Stuart Graham |
| Date: |
Wednesday, March 12, 2003 at 17:03:41 |
| Comments: |
could u plz help me.. my corsework task is to complete a 60 digit calculator but i can not get the subtract button to work could u plz help |
| From: |
Jennylene |
| Date: |
Monday, March 10, 2003 at 23:08:57 |
| Comments: |
Hi, I have to create a scientific calculator. I got the add to work. How do I get a backspace to work. To edit a single no? thanks in advance |
| Reply: |
You should just be able to remove the last character from the display
with this code:
| txtDisplay.Text = Left(txtDisplay.Text, Len(txtDisplay.Text) - 1) 'change
to whatever the display control is |
|
| From: |
Catherine E. De Jesus |
| Date: |
Tuesday, March 4, 2003 at 16:21:40 |
| Comments: |
A program code for MS; MR; M+; 1/x; square root; +/- in a scientific calculator |
| Reply: |
To give the calculator memory, you just declare a variable for
it. After that, use this code:
MS (memory clear?):
MR:
| txtDisplay.Text = calcmem 'change
to whatever the display control is |
M+:
| calcmem = calcmem + txtDisplay.Text |
Other functions:
1/x:
+/-:
|
| From: |
karen |
| Date: |
Wednesday, February 5, 2003 at 10:21:32 |
| Comments: |
step by step for the square root calculator with |
| Reply: |
The Sqr function works out the square root of a number |
| From: |
Sasi |
| Date: |
Tuesday, December 31, 2002 at 03:54:29 |
| Comments: |
How can i find sin inverse function in visual basic ? |
| Reply: |
The code you need for an inverse sine function is:
Function ArcSin(X As
Double) As Double
ArcSin = Atn(X / Sqr(-X * X + 1))
End Function |
|
| From: |
Karthik Senthilnathan |
| Date: |
Saturday, December 21, 2002 at 17:24:39 |
| Comments: |
Would you be able to give me the basic codes for a calculator in VB 6.0.
Like adding and subtracting dividing etc. Thanks |
| From: |
Vipin Razdan |
| Date: |
Tuesday, December 17, 2002 at 12:44:53 |
| Comments: |
It is very simplified explaination. Thank you very much |
Martin Allen 1999 - 2008. Last updated
Tuesday 28 October 2008 10:45:48 PM -0000.
|