|
-
Nov 23rd, 2011, 05:37 AM
#1
Thread Starter
Member
Calculation Problem
Hi guys,
I have some problem with the calculation.
When I press "0.01", it came out
0.0(When I press 0.0)
1(When I press 1)
What happen to my calculation?
Code:
Private Sub Command0_Click()
If (text1.Text = 0) Then
If (Shift = True) Then
text1.Text = "0.0"
Shift = False
Else
text1.Text = "0"
End If
Else
text1.Text = text1.Text & "0"
End If
End Sub
If u guys dont understand, it cannot have 0.01, 0.02....etc..
only 0.0
and then go back to 1.
Help!
-
Nov 23rd, 2011, 06:39 AM
#2
Addicted Member
Re: Calculation Problem
What's the code inside your "Command1_Click" event?
-
Nov 23rd, 2011, 06:45 AM
#3
Thread Starter
Member
Re: Calculation Problem
Here's my command 1 click
Code:
Private Sub Command1_Click()
If (text1.Text = 0) Then
If (Shift = True) Then
text1.Text = "0.1"
Shift = False
Else
text1.Text = "1"
End If
Else
text1.Text = text1.Text & "1"
End If
End Sub
and my decimal event
Code:
Private Sub cmdDot_Click()
Me.shiftPos
End Sub
-
Nov 23rd, 2011, 07:04 AM
#4
New Member
Re: Calculation Problem
Hi,
I can't figure out what you are trying to do , so pleaze try to explain so we can help you .
Cordially
-
Nov 23rd, 2011, 08:05 AM
#5
Thread Starter
Member
Re: Calculation Problem
 Originally Posted by S!dox
Hi,
I can't figure out what you are trying to do , so pleaze try to explain so we can help you .
Cordially
I am trying to output 0.01 to the textbox but it cannot. It goes up to 0.0 and when I press 1 it became 1, not 0.01
so its like
0
0.
0.0
1
You get it now?
-
Nov 23rd, 2011, 08:29 AM
#6
Addicted Member
Re: Calculation Problem
In your code for cmdDot_click, what on earth is "Me.shiftPos"? Is it from some library?
-
Nov 23rd, 2011, 09:14 AM
#7
Thread Starter
Member
Re: Calculation Problem
It's a way to display the dot.
What am I going to do now? 
Help!
-
Nov 23rd, 2011, 09:45 AM
#8
Re: Calculation Problem
What is Shift and what is ShiftPos?
They must be functions/subs that you wrote.
Why don't you zip up your project and attach it so we can see the same things that you are seeing?
-
Nov 23rd, 2011, 10:01 AM
#9
Hyperactive Member
Re: Calculation Problem
Try changing
Code:
If text1.Text = 0 Then
with
Code:
If text1.Text = "0" Then
and see if it works for you.
Also tell us if you have any code in your text1_Change() or text1_KeyPress() events.
If your problem is solved, then drag down the Thread Tools and mark your thread as Resolved.
If I helped you solve your problem, inflate some air into my ego by rating my post and adding a comment too.
For notorious issues (elaborate yourself) contact me via PM. I don't answer them in the forums EVER.
-
Nov 23rd, 2011, 10:03 AM
#10
Thread Starter
Member
Re: Calculation Problem
 Originally Posted by lone_REBEL
Try changing
Code:
If text1.Text = 0 Then
with
Code:
If text1.Text = "0" Then
and see if it works for you.
Also tell us if you have any code in your text1_Change() or text1_KeyPress() events.
You solved my problem. You're genius. + REP!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|