CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 1999
    Posts
    1

    Testing for an even number

    How can I test for an even or odd number in VB5? I can not find a command such as "isodd" in VB5. There must be a way to do it.


  2. #2
    Guest

    Re: Testing for an even number

    Use Mod operator:

    Dim intNumber as Integer
    'let's say
    intNumber=15
    If intNumber Mod 2 = 0 then
    MsgBox "Even Number"
    else
    MsgBox "Odd Number"
    End If



    Vlad


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured