Anda di halaman 1dari 5

Q51. How does the load statement differ from the show statement. Both are form methods.

To open a form and make it visible, show method is used . When we want to assign properties to a form and not shown on screen load method is used. In load method, the form is loaded in memory but not shown on the screen. Syntax of Show method is: Formname.Show style, ownerform Syntax of Load method is: Load<Formname>

Q52. What is control array? What are its utilities? A control array is a group of controls that share the same name type and the same event procedures. Adding controls with control arrays uses fewer resources than adding multiple control of same type at design time. Control array can be created at the following time Design time Run time

Control arrays are one of the most interesting features of the Visual Basic environment, and they add a lot of flexibility to the programs: Controls that belong to the same control array share the same set of event procedures; this often dramatically reduces the amount of code to be written to respond to a user's actions. We can dynamically add new elements to a control array at run time; in other words, we can effectively create new controls that didn't exist at design time. Elements of control arrays consume fewer resources than regular controls and tend to produce smaller executables. Besides, Visual Basic forms can host up to 256 different control names, but a control array counts as one against this number. In other words, control arrays let you effectively overcome this limit.

Q53. What do you mean by arrays of array? An array of which each element is itself an array is called an array of arrays, or a jagged array. Having arrays as elements is not the same thing as a multidimensional array, which has more than one index on a single array. Declaration of a jagged array:- Dim jaggedArray(D1)() As datatype

For example, you might have an array of months, each element of which is an array of days. Since different months have different numbers of days, the elements do not form a rectangular two-dimensional array. In such a case, you can use a jagged array instead of a multidimensional array.

Q54. What is a multi-dimesional array ? Ans. You may need to use two subscripts to identify tabular data, where data are arranged in rows and columns. To define a two-dimentional array or table, the Dim statement specfies the number of rows and columns in the array. The row is horizontal and the column is vertical. Syntax: Dim ArrayName ( [ LowerLimit To ] UpperLimit, [ LowerLimit To ] UpperLimit ) As Datatype Example: Dim strName ( 2, 3 ) As String Dim strName ( 0 To 2 , 0 To 3 ) As string

Q55.What is array. What are the types of array? How to allocate space for dynamic array? How to preserve information in a dynamic array? An array is a consecutive group of memory locations that all have the same name and the same type. To refer to a particular location or element in the array, we specify the array name and the array element position number. The Individual elements of an array are identified using an index. Arrays have upper and lower bounds and the elements have to lie within those bounds. Arrays occupy space in memory. The programmer specifies the array type and the number of elements required by the array so that the compiler may reserve the appropriate amount of memory.

There are two types of arrays in Visual Basic namely:

Fixed-size array : The size of array always remains the same-size doesn't change during the program execution. When an upper bound is specified in the declaration, a Fixed-array is created. The upper limit should always be within the range of long data type. Declaring a fixed-array Dim numbers(5) As Integer

If we want to specify the lower limit, then the parentheses should include both the lower and upper limit along with the To keyword. An example for this is given below. Dim numbers (1 To 6 ) As Integer In the above statement, an array of 10 elements is declared but with indexes running from 1 to 6.

Dynamic array : The size of the array can be changed at the run time- size changes during the program execution.

An array which can be resized or re-dimensioned at runtime is known as dynamic array. It can be declared by the dim keyword with empty parenthesis & redimensioned by the redim statement. Redim statement can only appears within a procedure because it is an executable statement which makes the application carries out an action only at runtime. E.g Dim x () as integer Redim x (5) as integer

Q56. What is a purpose of splash screen? Ans: Perhaps you have noticed the logo or window that often appears while program is loading. This initial form is called splash screen. Professional applications use splash screens to tell the user that the program is loading and starting. It can make a large application appear to load and run faster, since something appears on the screen while the rest of the application loads. You can create your own splash screen or use the splash screen template included woth Visual Basic. In the add form dialog box, choose the Splash screen to add a new form; then modify the form as you need.

Q57. How can we create a pop-up menu? In visual basic we can display a context menu by calling the pop-up menu method and passing it any top level menu object. For Ex: if we have an edit menu named mnuedit with cut, copy and paste submenus, we can display a content menu with the cut, copy, and paste commands by calling pop-up Menu mnuedit. code private Sub mnuCut_click() MsgBox you selected cut End Sub private Sub mnuCopy_click() MsgBox you selected copy

End Sub private Sub mnuPaste_click() MsgBox you selected paste End Sub Private Sub Form_MouseDown( Button as Integer, Shift as Integer, X as single, Y as Single) If button = Vb Right button then Pop-up Menu mnuEdit End if End sub Q58. Distinguish between procedure and function? Sl.No. 1 Function Function is mainly used in the case where it must return a value. Function can be called from SQL statements Functions are normally used for computations A Function returns 1 value only A function can only return a value Procedure A procedure may or may not return a value or may return more than one value using the OUT parameter. Procedure can not be called from the sql statements Procedures are normally used for executing business logic. Procedure can return multiple values (max 1024). A procedure may modify an object

2 3 4 5

Q59. What is procedure? A procedure is a set of one or more program statements that can be executed by referring to the procedure name. We can reuse the code written in a procedure, as it can be executed any number of times by making a call to the procedure. Advantage:1) Allow us to break an application into discrete logical units, thus making the application more readable. 2) Procedures help in debugging an application because debugging separate units of an application is easier them debugging the application as a whole. 3) Procedures are reusable across programs with little or no modification.

Q60. How many types of procedures are there in Visual Basic? a) Sub procedure: Sub procedure has two types:--

(i)

General procedure: A general procedure is a block of code that performs a specific task. If we need to perform as specific task posted of writing the code multiples times in different parts of the application, we can write the code in a procedure and call the procedure from anywhere within the application. It is a declared as public then other application can use it. Event handling procedure: An Event handling procedure is a block of code that is executed when a specific event occurs, such as the click of button the loading of a form in the memory or fulfillment of a user defined condition. Example: If a user click a command button object with the name command1, the procedure named command1_click() is called and the code within the procedure is execute.

(ii)

b) Function procedure: A function procedure is a block of code enclosed within the function. End function statements a function procedure unlike a sub procedure, returns a value to the calling code. If we need a procedure to returns a value so that the return value can be further procedure in the calling code, we should create a function procedure instead a sub procedure. c) Property procedure: A property procedure is a set of code statements that are used to assign or creative the value of the properties declared with in a module, a class or a structure. Properties are type of variables that store the values for an object of a class or a structure.

Anda mungkin juga menyukai