Tuesday, June 1, 2021

Odd and Even Numbers in Visual Basic 6

 A simple program to ask the user to give a number and then the program will check if the given number is odd or even using Microsoft Visual Basic 6 programming language.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website, kindly contact me also at my email address also. Thank you.

My email address is jakerpomperada@gmail.com and jakerpomperada@yahoo.com

My mobile number here in the Philippines is 09173084360.









Program Listing

' Odd and Even Numbers in Visual Basic 6

' Jake Rodriguez Pomperada, MAED-IT, MIT

' www.jakerpomperada.blogspot.com  www.jakerpomprada.com

' jakerpompeada@gmail.com

' Bacolod City, Negros Occidental Philippines

' May 31, 2021


Private Sub cmdCheck_Click()

x = Val(Form1.txtVal.Text)

If ((x Mod 2) = 0) Then

  Label2.Caption = "The given number " & x & " is an even number."

Else

  Label2.Caption = "The given number " & x & " is an odd number."

End If

End Sub


Private Sub cmdClear_Click()

Form1.txtVal.Text = ""

Label2.Caption = ""

Form1.txtVal.SetFocus

End Sub


Private Sub cmdQuit_Click()

answer = MsgBox("Do you want to quit?", vbQuestion + vbYesNo, "Confirm")

If answer = vbYes Then

End

Else

MsgBox "Action canceled", vbInformation, "Confirm"

Form1.txtVal.Text = ""

Label2.Caption = ""

Form1.txtVal.SetFocus

End If

End Sub


Private Sub Form_Load()

' Center the form on the screen

 Me.Move (Screen.Width - Me.Width) / 2, _

     (Screen.Height - Me.Height) / 2


End Sub



1 comment:

  1. Muchas gracias. Soy Edgar Linares, desde Venezuela.

    ReplyDelete