How to Reverse Set of Numbers in VB.net
Submitted by janobe on Monday, October 8, 2018 - 19:34.
This simple program can be use as one of your activity in programming subject. It’s kind of interesting to know how to reverse set of numbers especially when done in VB.Net. Surely, your student will have fun learning this simple program.
For any questions about this article. You can contact me @
Email – [email protected]
Mobile No. – 09305235027 – TNT
FB Account – https://www.facebook.com/onnaj.soicalap
Creating Application
Step 1
Open Microsoft Visual Studio 2015 and create a new windows form application. After that, do the form just like shown below.
Step 2
Double click the form to fire the code view. In the code view, declare an integer and create a function to reverse the given number in the textbox.- Dim r As Integer
- Public Function Reverse(rn As Integer)
- Dim numbers = Val(TextBox1.Text)
- Dim result As Integer
- While numbers > 0
- rn = numbers Mod 10
- result = result * 10 + rn
- numbers = numbers \ 10
- End While
- Reverse = result
- End Function
Step 3
Do the following codes to display the reverse numbers in another textbox when clicked.- Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
- TextBox2.Text = Reverse(r)
- End Sub
Add new comment
- 6083 views