Question

In: Computer Science

can anyone give me an example of an Array and its usage in Visual Basic programming

can anyone give me an example of an Array and its usage in Visual Basic programming

Solutions

Expert Solution

Array:

-> An array is a collection of elements of the same data type in Visual Basic programming.

-> It is used to store elements and one variable of an array can store multiple values, unlike normal variables.

-> Mostly used arrays are one-dimensional array and two-dimensional array.

-> One-dimensional array is used to store elements either row-wise or column-wise.

-> Two-dimensional array is used to store elements in tabular form.

Real-life examples of an array:

1) an array of eggs

2) Roll numbers of all the students of the same class(all roll numbers have the same data type ).


Example: VB program to store 5 integers in an array and display as stored.


Program:

Private Sub Command1_Click()
'declaration of an array
Dim arr(5) As Integer
Dim i As Integer

'storing 5 integers into the array
For i = 0 To 4
arr(i) = CInt(InputBox("Enter an integer: "))
Next i

' displaying the elements of the array into the textbox
For i = 0 To 4
txtArray.Text = txtArray.Text & arr(i) & vbNewLine
Next i

End Sub

Output:


Related Solutions

can anyone give me an example of a job analysis?
can anyone give me an example of a job analysis?
Can anyone explain what is the difference between EARs and APRs? please give me an example....
Can anyone explain what is the difference between EARs and APRs? please give me an example. I am little confused about the quoted rate. Can anyone explain it? What is a pure discount loan please give me an example? What does it mean to amortize a loan?
Can anyone give me a summary on "Dismantling the doctrine of Discovery" ?
Can anyone give me a summary on "Dismantling the doctrine of Discovery" ?
Can someone give me an example an non example of coefficient?
Can someone give me an example an non example of coefficient?
can anyone give me information on inorganic and organic compounds in detail please
can anyone give me information on inorganic and organic compounds in detail please
windows forms Application using Visual Basic use visual basic 2012 Part 1: Programming – Income Tax...
windows forms Application using Visual Basic use visual basic 2012 Part 1: Programming – Income Tax Application 1.1 Problem Statement Due to upcoming end of financial year, you are being called in to write a program which will read in a file and produce reports as outlined. Inputs: The input file called IncomeRecord.txt contains a list of Annual income records of employees in a firm. Each record is on a single line and the fields are separated by spaces. The...
can anyone give me a code for nodemcu wifi chip for displaying temperature and humidity to...
can anyone give me a code for nodemcu wifi chip for displaying temperature and humidity to app where temp and humidity data is sent to cloud and then cloud sends the data to mobile app
who can give me the example like this:(also give me the answer,Tell me what formula should...
who can give me the example like this:(also give me the answer,Tell me what formula should use to calculate and how to use those formulas.)thank you Known: risk profolio. expect return and variance of stock A. expect return and variance of stock B. The yield correlation coefficient of two stocks. Risk combination characteristics Question: expect return. variance. Build a complete portfolio according to the investor's requirements. How many should investors invest in risk portfolios and security assets(T-bill). Calculating the sharp...
I am trying to write code for a program in Visual Studo using Visual Basic programming...
I am trying to write code for a program in Visual Studo using Visual Basic programming language that computes the factorial of an entered number by using a For Loop. My problem is that it keeps re-setting the variable for Factorial. Below is my code if anyone can help. I want it to multiply the given number by that number - 1, then continuing to do so until it hits zero without multiplying by zero. Private Sub BtnCalculate_Click(sender As Object,...
Explain the difference between array and structure based on their usage in C++ programming. Declare a...
Explain the difference between array and structure based on their usage in C++ programming. Declare a structure called studentScore which contains name of student, registration number of students, course code and marks. Declare structure variable named studentCS680 based on the structure in (b) to store fifty (50) students’ data. Write a program that prompts a user to enter data for 50 students in a structure variable declared in (b) and calculate the average mark.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT