In previous post, I have discussed about a new project , i.e. creating scientific calculator. Now, we shall add the number buttons, a cancel button and a dot button. The number buttons are created as an array of buttons, and each button will be identified with its index, corresponding to its caption.
I will also replace the display panel with a label so that the users won't be able to erase the number. They can only clear the number by clicking the cancel button. The alignment property of the label is set to right justified, so that the digit entered will start from the right position, similar to the conventional calculator.
The value of pi is now obtained by using the Atn function (Arc Tangent). We know that Tan(pi/4)=1, so Atn(1)=pi/4, therefore pi=Atn(1)*4. By using this function, we will obtain a more accurate value of pi.
In this project, we shall also limit the numbers to be less than 30 digit. If any user enters a number with more than 30 digits, an error message "data overflow" will be shown.
The Interface:
The code :
Dim Num_of_digit As Integer
Private Sub buttonNum_Click(Index As Integer)
If Num_of_digit > 0 And Num_of_digit <> "0" Then
panel.Caption = panel.Caption + Right$(Str$(Index), 1)
ElseIf panel.Caption = "0" Then
panel.Caption = Str$(Index)
End If
ElseIf Num_of_digit >= 30 Then
panel.Caption = "Data Overflow"
Else
panel.Caption = Right$(Str$(Index), 1)
End If
Num_of_digit = Num_of_digit + 1
End Sub
Private Sub Clear_Click()
panel.Caption = "0"
Num_of_digit = 0
End Sub
Private Sub Command1_Click(Index As Integer)
Dim x As Double
Dim pi As Double
pi = Atn(1) * 4
Select Case Index
Case 0
x = Val(panel.Caption)
panel.Caption = Round((Sin(x * pi / 180)), 4)
Num_of_digit = 0
Case 1
x = Val(panel.Caption)
panel.Caption = Round((Cos(x * pi / 180)), 4)
Num_of_digit = 0
Case 2
x = Val(panel.Caption)
panel.Caption = Round((Tan(x * pi / 180)), 4)
Num_of_digit = 0
End Select
End Sub
3 comments:
[url=http://community.bsu.edu/members/buy+online+Viagra.aspx]Viagra xr online[/url]
[url=http://eterporno.ru/volgogradskie-znakomstva.php]волгоградские знакомства[/url]
[url=http://eterporno.ru/seks-znakomstva-chernigov.php]секс знакомства чернигов[/url]
[url=http://pc.eterporno.ru/znakomstvo-biseksualov.php]знакомство бисексуалов[/url]
[url=http://pc.eterporno.ru/eroticheskie-rasskazy-intim.php]эротические рассказы интим[/url]
[url=http://pv.eterporno.ru/dagestanskie-shluhi.php]дагестанские шлюхи[/url]
[url=http://pv.eterporno.ru/melkie-blyadi.php]мелкие бляди[/url]
[url=http://pv.eterporno.ru/orenburg-intim-uslugi-seks.php]оренбург интим услуги секс[/url]
[url=http://px.eterporno.ru/prostitutki-moskvy-deshovye-vyezd.php]проститутки москвы дешовые выезд[/url]
[url=http://px.eterporno.ru/intim-znakomstva-novgorod-novost.php]интим знакомства новгород новость[/url]
[url=http://pz.eterporno.ru/dosug-nu.php]досуг ну[/url]
[url=http://pz.eterporno.ru/seks-bolshogo-goroda.php]секс большого города[/url]
Hello !.
You re, I guess , probably very interested to know how one can make real money .
There is no need to invest much at first. You may begin to get income with as small sum of money as 20-100 dollars.
AimTrust is what you need
AimTrust represents an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.
It is based in Panama with offices around the world.
Do you want to become an affluent person?
That`s your choice That`s what you desire!
I`m happy and lucky, I began to take up income with the help of this company,
and I invite you to do the same. If it gets down to choose a correct companion utilizes your funds in a right way - that`s it!.
I make 2G daily, and my first investment was 500 dollars only!
It`s easy to get involved , just click this link http://opinywukaw.100megsfree5.com/rosiwur.html
and go! Let`s take our chance together to become rich
Hi !.
You may , perhaps very interested to know how one can reach 2000 per day of income .
There is no need to invest much at first. You may begin to get income with as small sum of money as 20-100 dollars.
AimTrust is what you thought of all the time
AimTrust incorporates an offshore structure with advanced asset management technologies in production and delivery of pipes for oil and gas.
Its head office is in Panama with affiliates everywhere: In USA, Canada, Cyprus.
Do you want to become an affluent person?
That`s your chance That`s what you wish in the long run!
I feel good, I began to get income with the help of this company,
and I invite you to do the same. If it gets down to select a proper companion utilizes your savings in a right way - that`s the AimTrust!.
I make 2G daily, and what I started with was a funny sum of 500 bucks!
It`s easy to get involved , just click this link http://jykywyfu.freecities.com/ahylyt.html
and go! Let`s take our chance together to feel the smell of real money
Post a Comment