Programming Tools
Problem for Programming Tools
Generic problem for all Programming Tools

Need help in Special Formatting Number




By KVL Liana on Aug 06, 2008

" "
Sir,
Is there any way to write Code using VB so as to be able to check the given numbe is in multiple of a given number.


Solution #1

posted on Nov 29, 2008
Not Rated)

royal4

Rank: Apprentice 
Rating: 0%, 0 votes
Here is one solution. You might consider adding more robust error handling.
if the decimal numbers passed to the div function are multiples i will be a non-zero number of that multiple otherwise i will be zero.

Dim i As Integer
i = div(12, 0)
If i = 0 Then
'not multiple
' do this
Else
' is multiple
' do something else
End If


Function div(ByVal numerator As Object, ByVal denominator As Object) As Integer
dim n , d decimal
Dim result As Decimal
Dim remainder As Decimal

If IsNumber(numerator) Is True _
And IsNumber(denominator) Is True Then
If numerator <> 0 Then
n = numerator
d = denominator
Else
GoTo error1
End If
Else
GoTo error1
End If
result = Decimal.divide(n, d)
remainder = Decimal.remainder(n, d)
If remainder = 0 Then
div = result
Else
div = 0
End If

Exit Function
error1:
msgbox("Numbers must be non-zero numerics", , "Multiple check error")
div = 0
End Function

End Function
Was this helpful?
Yes
No

Popular Solutions for Programming Tools


Questions and Unsolved Problems for Programming Tools


Answer
where can I get a customer tool disk for a sharp xa-a41s??

Answer
i need help getting into my computer i forgot my password, and this is a toshiba satillite with... (More)

Answer
i download necrovision patch v.1.1 why is not working

Answer
Can't get the software to work so I can download the pictures I am running vista home premium HELP!


Didn't find what you were looking for?

Describe your Programming Tools problem:

Select a Category:







Ask our Experts

 

Solve Your Problem Now!
Chat Live with an Expert
Chat Now
Top Programming Tool Experts



Top Computer & Laptop Repairmen
in , PA
(952) 890-7770
Zkarlo.com provides discount and used laptop parts...
Zkarlo.com

(877) 934-6198
Send your laptop to us and we will diagnose the...
A+ Rated Oceanside Computer Sales & Service, LLC


       
Solve Your Problem Now!
Chat Live with an Expert
Chat Now

Insert Link
Insert Image
Insert You-Tube clip
Insert List
Insert List
Spell Check

What is this?



Select