Builld a Pyramid with numbers using Visual Basic Nested Loop

Now we will learn how to create a triangular figure with Visual Basic 2008. By creating this program, we can train our ability to use the Nested Looping (repeating loop) in VB 2008. In addition, here we can also find the use Textbox with multiline property.

First we create the design of the form as shown below :

Triangle Pyramid with numbers using VB 2008
The components in the form above is:
  • Label with the text property: High Pyramid
  • NumericUpDown with minimum properties: 2
  • Button with text property: Show and Exit
  • TextBox with multiline property is True, also in order to set the font to Courier New property
Courier New is selected so the display will not lopsided pyramid. Courier New font has unique properties of each type of letter that is the same width, so it will be performing a pyramid with the kind of balanced form.

Now double-click the button with the text property Show, and enter the following code:


Next, double-click the button with the text property "Exit", then type the following code:

end

If so, please press F5 to run the program, when the program runs, the results are as below:
Triangle Pyramid Visual basic


Previous
Next Post »