N/APosted on - 04/06/2015
I am new to computer programming. I am studying Visual Basic 10 now. I want to know how to create a program that will accept array of integers and display it after putting the numbers. I would like to set also the size of the array. How can this be achieved? What are the declarations that I need to use to make this work? Is there any special functions that I can use in VB 10 to make this happen? Or do I need to created my own sets of declaration?
Creating a simple but diverse program in Visual Basic 10
There many ways to create programs in Visual Basic 10. Let’s just have a few review before we start.
Visual – means graphically you can see the objects that you will add in your program.
BASIC – Beginner’s All-Purpose Symbolic Instruction Code.
GUI – the Graphical User Interface of VB is so unique and ever to be the first to offer the easiest way to develop program and to see exactly right away how it will look.
Toolbox- you can use this to add objects like Textboxes, Command Buttons, Radio Option Buttons, etc.
Properties Window – this will show you all available properties of each object added and change its values.
Here are some tips that you can use to create a simple program with array.
You mentioned that you need to set first the size of array so let’s say 10 integers to be stored in your array.
“Please enter the size of your array [1-10]” <<< This message will be posted to your program. How to do this. You can use the “Caption/Label” tool to display this.
enterSize=InputBox(“enter size [1-10]: “,””,””)
After initiating the size of your array you can store now the values of each array indices multiple times. How to do this? Better to use Input Box that will accept the values of your array. Use a For Statement to make the loop to take all integers and be stored to your array. For example you will accept 5 integers for your array.
For i=0 to 4
enterValues=InputBox(“Enter values: “,””,””)
After storing the values of your array to the indices available you can now display the integers entered.