How to Reverse Set of Numbers in VB.net

Submitted by: 
Visitors have accessed this post 115 times.

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.

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.
reverse101

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.

  1. Dim r As Integer
  2. Public Function Reverse(rn As Integer)
  3. Dim numbers = Val(TextBox1.Text)
  4. Dim result As Integer
  5. While numbers > 0
  6. rn = numbers Mod 10
  7. result = result * 10 + rn
  8. numbers = numbers \ 10
  9. End While
  10. Reverse = result
  11. End Function

Step 3

Do the following codes to display the reverse numbers in another textbox when clicked.

  1. Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  2. TextBox2.Text = Reverse(r)
  3. End Sub

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


Add new comment

Filtered HTML

  • Web page addresses and e-mail addresses turn into links automatically.
  • You may insert videos with [video:URL]
  • Allowed HTML tags: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd> <table> <tr> <td> <th> <img> <h1> <h2> <h3> <iframe> [video]
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <asp>, <c>, <cpp>, <csharp>, <css>, <html4strict>, <java>, <javascript>, <mysql>, <php>, <python>, <sql>, <vb>, <vbnet>. The supported tag styles are: <foo>, [foo].
  • Lines and paragraphs break automatically.

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.