6. Write a VB program to display the reverse of a given number using function.


Dim r As Integer
Public Function Reverse(r)
n = Val(Text1.Text)
While n > 0
r1 = n Mod 10
s = s * 10 + r1
n = n \ 10
Wend
Reverse = s
End Function
Private Sub cmdClear_Click()
Text1.Text = “”
Text2.Text = “”
Text1.SetFocus
End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub cmdReverse_Click()
rev = Reverse(r)
Text2.Text = rev
End Sub

Private Sub Form_Activate()
Text1.SetFocus
End Sub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s