How to Get Factorial Numbers in VB.Net

Submitted by: 
Visitors have accessed this post 195 times.

This time, let’s learn how to get factorial numbers in VB.Net. If we say factorial number, it means a number which is multiply itself to its decreasing numbers and it is denoted by the symbol (!). Like for example the factorial number or value of 5. This is how it looks like, 5! = 5 x 4 x 3 x 2 x 1 = 120. Now, let’s try doing this with codes in VB.Net. Just simply follow the instructions below.

Creating Application

Step 1

Open Microsoft Visual Studio 2015 and create a new windows form application.

Step 2

Add the Label, Button and a TextBox inside the Form.

Step 3

Double click the button and do the following code inside the sub procedure for getting factorial numbers.

  1. Dim n, f, i As Integer
  2. f = 1
  3. n = Val(TextBox1.Text)
  4. For i = 1 To n
  5. f = f * i
  6. Next
  7. MsgBox(“Factorial is :” & f, vbInformation, “Factorial”)

For any questions about this article. You can contact me @

Email – [email protected]
Mobile No. – 09305235027 – TNT
FB Account –
Or feel free to comment below.

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.
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.