Welcome to Dream.In.Code
Become a VB Expert!

Join 150,147 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,345 people online right now. Registration is fast and FREE... Join Now!




calculator cannot compute continiously

 
Reply to this topicStart new topic

calculator cannot compute continiously, help me pls..

kEsiah
17 Jul, 2008 - 05:18 AM
Post #1

New D.I.C Head
*

Joined: 26 Jun, 2008
Posts: 2

CODE
Dim first As Double
Dim second As Double
Dim third As Double
Dim sign As String
Dim calculated As Boolean

Private Sub Command1_Click(Index As Integer)
If Text1.Text = " " Then
Text1.Text = Command1(Index).Caption
ElseIf Text1.Text = "0" Then
Text1.Text = Command1(Index).Caption
Else
Text1.Text = Text1.Text & Command1(Index).Caption
End If
End Sub

Private Sub Command2_Click()
If InStr(Text1.Text, ".") = 0 Then
Text1.Text = Text1.Text & "."

End If
End Sub


Private Sub Command3_Click()
second = Text1.Text

If sign = "+" Then
Text1.Text = (first + second)

ElseIf sign = "-" Then
Text1.Text = (first - second)

ElseIf sign = "*" Then
Text1.Text = (first * second)

ElseIf sign = "/" Then
Text1.Text = (first / second)

End If
End Sub

Private Sub Command4_Click(Index As Integer)
first = Text1.Text
Text1.Text = " "
sign = Command4(Index).Caption

End Sub





Private Sub Command5_Click()
Text1.Text = "0"


End Sub

Private Sub Command6_Click()
Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1)

If Text1.Text = "" Then

Text1.Text = "0"

End If
End Sub

Private Sub Form_Load()
Text1.MaxLength = 12
End Sub


<this is my codes making an calculator in array.. but theres some problems here.. hmm it cannot compute continiously, example: 1+1+1+1=4 like that hope so some1 can help me.. plz...>
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Calculator Cannot Compute Continiously
17 Jul, 2008 - 07:52 AM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,319



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
Please use code.gif tags when posting code.

Modified title to be more descriptive.
User is offlineProfile CardPM
+Quote Post

OliveOyl3471
RE: Calculator Cannot Compute Continiously
18 Jul, 2008 - 09:42 PM
Post #3

Be my fiduciary ♥
Group Icon

Joined: 11 Jul, 2007
Posts: 2,139



Thanked: 27 times
Dream Kudos: 400
My Contributions
There might be an answer for you here:
http://www.dreamincode.net/forums/showtopic50628.htm
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 02:27AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month