Hi all :wave:
Use Check this code :confused:
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!!!!
Printable View
Hi all :wave:
Use Check this code :confused:
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!!!!
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
Or use thisVB Code:
MsgBox CLng(Text1.Text) - CLng(Text2.Text)
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!!
yes, Format(Text1.Text, "0") does that...check it and post if any probs...
Or
will remove the comma and Val will evaluate the value correctly.VB Code:
Text1.Text = FormatNumber(Text1.Text, 0, , , vbFalse)
Regards
Doug
Due to my this problem shuka ali tell me before two days for using formatnumber functionQuote:
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
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
Did you try Doogle's suggestion? That will solve your problem.
Checking
THIS IS PERFECTQuote:
visual basic code:--------------------------------------------------------------------------------
Text1.Text = FormatNumber(Text1.Text, 0, , , vbFalse)
--------------------------------------------------------------------------------
will remove the comma and Val will evaluate the value correctly.
Regards
Doug