|
-
Jul 5th, 2006, 02:22 AM
#1
Thread Starter
Just Married
[RESOLVED] whats wrong here!!!?
Hi all
Use Check this code
VB Code:
Private Sub Form_Load()
Text1.Text = 1000.05
Text1.Text = FormatNumber(Text1.Text, 0)
Text2.Text = 77
MsgBox Val(Text1.Text) - Val(Text2.Text)
End Sub
Help Urgent!!!!
-
Jul 5th, 2006, 02:27 AM
#2
Re: whats wrong here!!!?
is there any specific reason to use FormatNumber, else try this code using format function
VB Code:
Private Sub Form_Load()
Text1.Text = 1000.05
Text1.Text = Format(Text1.Text, "0")
Text2.Text = 77
MsgBox Val(Text1.Text) - Val(Text2.Text)
End Sub
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Jul 5th, 2006, 02:31 AM
#3
Re: whats wrong here!!!?
Or use this
VB Code:
MsgBox CLng(Text1.Text) - CLng(Text2.Text)
Use [code] source code here[/code] tags when you post source code.
My Articles
-
Jul 5th, 2006, 02:35 AM
#4
Thread Starter
Just Married
Re: whats wrong here!!!?
Ya sir There is a reason
see the example
i m using formatnumber because i want to comvet
1.23 as 1
1.49 as 1
1.51 as 2
1.99 as 2
so i m using this
thanks!!
-
Jul 5th, 2006, 02:37 AM
#5
Re: whats wrong here!!!?
yes, Format(Text1.Text, "0") does that...check it and post if any probs...
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Jul 5th, 2006, 02:41 AM
#6
Re: whats wrong here!!!?
Or
VB Code:
Text1.Text = FormatNumber(Text1.Text, 0, , , vbFalse)
will remove the comma and Val will evaluate the value correctly.
Regards
Doug
-
Jul 5th, 2006, 02:51 AM
#7
Thread Starter
Just Married
Re: whats wrong here!!!?
i m using formatnumber because i want to comvet
1.23 as 1
1.49 as 1
1.51 as 2
1.99 as 2
Due to my this problem shuka ali tell me before two days for using formatnumber function
but it is show wrong subtraction
so i want to ask that can i use format function at replacement of formatnumber then what is difference between both this function
confusion what code i use
GaneshMorrty Sir Code Of Format Function
O shuja ali code of Format number
Help Urgent u both
-
Jul 5th, 2006, 03:05 AM
#8
Re: whats wrong here!!!?
Did you try Doogle's suggestion? That will solve your problem.
Pete
No trees were harmed in the making of this post, however a large number of electrons were greatly inconvenienced.
-
Jul 5th, 2006, 03:11 AM
#9
Thread Starter
Just Married
-
Jul 5th, 2006, 03:16 AM
#10
Thread Starter
Just Married
Re: whats wrong here!!!?
visual basic code:--------------------------------------------------------------------------------
Text1.Text = FormatNumber(Text1.Text, 0, , , vbFalse)
--------------------------------------------------------------------------------
will remove the comma and Val will evaluate the value correctly.
Regards
Doug
THIS IS PERFECT
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
|