































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
































V Semester-B.Sc, BISM, BCA Unit 1 Part A (2 Marks)
1. Write any three common properties for several visual basic controls. BackColor and ForeColor - The BackColor property sets the background color of an object while the ForeColor property changes the foreground color used to display text. Caption -It sets the text displayed in the object's title bar or on the object. Font -You can set the font property from the Properties Window. 2. What is toolbox? List the common collection of tools. Displays the standard Visual Basic controls plus any ActiveX controls and inser table objects you have added to your project. The tools in toolbox are label, textbox, combobox, option button, checkbox, command button. 3. Define Variables. How to declare variable variables are areas allocated by the computer memory to hold data. In Visual Basic, it is a good practice to declare the variables before using them by assigning names and data types. They are normally declared in the general section of the codes' windows using the Dim statement. Dim VariableName As DataType Dim yourName As String Dim firstnum As Integer 4. Define Constants. Constants are different from variables in the sense that their values do not change during the running of the program. Constant Name As Data Type = Value Const Pi As Single=3. 5. List the built_in functions with example. Rnd is is very useful function for dealing with the concept of chance and probability. Print Rnd Int is the function that converts a number into an integer by truncating its decimal part. Int(0.032)= Log is the function that returns the natural Logarithm of a number. For example, Log 10= 2. 6. How to declare multidimensional arrays in VB? Dim a(2,3) as integer 2 represent rows 3 represents column 7. Define array. An array is a set of values that are logically related to each other, such as the number of students in each grade in a grammar school. Declare a single-dimension array of 5 values Dim numbers(4) As Integer 8. Write the syntax of inputbox function. Explain. An InputBox( ) function will display a message box where the user can enter a value or a message in the form of text. The format is myMessage=InputBox(Prompt, Title, default_text, x-position, y-position)
9. What are image controls? The Image Box is another control that handles images and pictures. It functions almost identically to the picture box. Image1.Picture=LoadPicture ("C:\VBprogram\Images\grape.gif") 10. What are labels? The label is a very useful control for Visual Basic, as it is not only used to provide instructions and guides to the users, it can also be used to display outputs. One of its most important properties is Caption. 11. Write note on variant data type. A Variant is a special data type that can contain any kind of data except fixed-lengthString data. Dim a 12. Explain about the Text Box The text box is the standard control for accepting input from the user as well as to display the output. It can handle string (text) and numeric data but not images or pictures. Text1.text=”hai”.
More than < Less Than = More than or equal <= Less than or equal <> Not Equal to **_____________________________________________________________________________________ Unit 1 Part B (5 Marks)
Resize the form according to the setting of AutoSizeMode.
BackColor
Gets or sets the background color for the control.
Font
Gets or sets the font of the text displayed by the control.
Name
Gets or sets the name of the control.
ResizeRedraw
Gets or sets a value indicating whether the control redraws itself when resized.
4. Explain about the form with its properties and methods.
Text Gets or sets the current text in the TextBox.
Unit 1 Part C (10 Marks)
1. Explain the VB controls and their uses with example.
2. Explain about the IDE of VB indetail.
Consist Of A Number Of Element Including Menu Bar, Title Bar, Tool Bar, Tool Box, Project Explorer And Properties Window. The Main Window In The Middle Of the Screen Contain A Form Named Form One The Form Is The Application Window Were The Uses Interfaces Can Be Placed Menu Bar :- The Menu Bar Contains The Command Needed To Works With Visual Basic File :- Contains The Command For Opening And Saving Projects Edit :- Contains Editing Commands And Other Formatting Tools View :- Contains Command For Showing Or Hiding Components Of Hide Project: - Contains Commands That Add Components To The Current Project Format:- Contains commands for aligning the control on the form Debug :- contains debugging tools Run :- contains commands start, break and end execution Query :- contains commands that simple the structure query language
Project explorer displaced the components of the project. The user can switch over form code to design view and viz.. Properties windows
Properties windows displays the properties of a form on a control.properties Are artibutes of an object search as its size,name,captions and color. Form layout
The form layout window in the lower right corner of the vb IDE. It is use to determain the initial position form in the application this window is usefull for the application that use multipul forms Tool box :-
Tool box contains a set of controls with are used to customized form using this controls and interface between user and application can be created by default tool box contains 21 activex controls to place a control on a form select it with the mouse and then move the mouse over the form. And draw the control on the form. Otherway is just double click on the required controls. Pointer :- pointer is uded to interact with the controls on the form.
Form is the work places in visual basic were the user can place controls in it the header area as a caption. Control menu and maximums, minima’s closed button. The large area of the form is called the client area in visual basic the basic building block of on application is a form which is simple a window and controls like check box, text box, label etc..or place in it. __________________________________________________________________________________________
Unit II Part A (2 Marks)
1. Give the syntax of Instr function. InStr([start,]string1,string2[,compare]) Parameter Description start Optional. Numeric expression that sets the startingposition for each search. Default 1. string1 Required. String expression being searched. string2 Required. String expression searched for. compare Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. 2. How to display information on a form? Print method is used to display information in a form. Formname.print”string expression” Form1.print”welcome” 3. Illustrate the concept of with statement. Executes a series of statements that repeatedly refer to a single object or structure so that the statements can use a simplified syntax when accessing members of the object or structure. With objectExpression [ statements ] End With 4. What are determinate loops?discuss with example. The For...Next construction performs the loop a set number of times. It uses a loop control variable, also called a counter or determinate lops , to keep track of the repetitions. 5. Define array. An array is a set of values that are logically related to each other, such as the number of students in each grade in a grammar school. Declare a single-dimension array of 5 values Dim numbers(4) As Integer 6. What are the two types of array? a. Fixed Dim a(5) as integer b. Dynamic Dimb() as integer 7. What are public variables? Public variable can be accessed globally in a project. Public con as string
Case Else result.Caption="Fail" End Select End Sub
2. Write note on looping statement in visual basic. Visual Basic allows a procedure to be repeated many times until a condition or a set of conditions is fulfilled. This is generally called looping. Looping is a very useful feature of Visual Basic because it makes repetitive works easier. There are two kinds of loops in Visual Basic, the Do...Loop and the For.......Next loop. Do Loop The Do Loop statements have three different forms, as shown below: a) Do While condition Block of one or more VB statements Loop b) Do Block of one or more VB statements Loop While condition c) Do Until condition Block of one or more VB statements Loop d) Do Block of one or more VB statements Loop Until condition Example: Do while counter <= num.Text=counter counter =counter+ Loop For....Next Loop The For....Next Loop event procedure is written as follows: For counter=startNumber to endNumber (Step increment) One or more VB statements Next Example: For counter=1 to 10 display.Text=counter Next The While….Wend Loop The structure of a While….Wend Loop is very similar to the Do Loop. it takes the following form: While condition Statements Wend
3. Write a short note on messagebox. The objective of MsgBox is to produce a pop-up message box that prompt the user to click on a command button before he /she can continues. This format is as follows: yourMsg=MsgBox(Prompt, Style Value, Title) The first argument, Prompt, will display the message in the message box. The Style Value will determine what type of command buttons appear on the message box, please refer Table 10.1 for types of command button displayed. The Title argument will display the title of the message board. Style Value Named Constant Buttons Displayed 0 vbOkOnly Ok button 1 vbOkCancel Ok and Cancel buttons 2 vbAbortRetryIgnore Abort, Retry and Ignore buttons. 3 vbYesNoCancel Yes, No and Cancel buttons 4 vbYesNo Yes and No buttons 5 vbRetryCancel Retry and Cancel buttons Example: Private Sub Test_Click() Dim testmsg As Integer testmsg = MsgBox("Click to test", 1, "Test message") If testmsg = 1 Then Display.Caption = "Testing Successful" Else Display.Caption = "Testing fail" End If End Sub 4. Explain the math function in visual basic. The mathematical functions are very useful and important in programming because very often we need to deal with mathematical concepts in programming such as chance and probability, variables, mathematical logics, calculations, coordinates, time intervals and etc. Visual Basic 6 function Description Abs Returns the absolute value of a specified number. Atn Returns a Double value containing the angle whose tangent is the specified number. Cos Returns a Double value containing the cosine of the specified angle. Exp Returns a Double value containing e (the base of natural logarithms) raised to the specified power. Log Returns a Double value containing the logarithm of a specified number. This method is overloaded and can return either the natural (base e)
= More than or equal <= Less than or equal <> Not Equal to Logical Operators In addition to conditional operators, there are a few logical operators that offer added power to the VB programs. Operator Meaning And Both sides must be true Or One side or other must be true Xor One side or other must be true but not both Not Negates truth
6. Explain the Date and Time functions in VB. Function Extracted Portion Year ( ) Year (Now) Month ( ) Month (Now) Day ( ) Day (Now) WeekDay ( ) WeekDay (Now) Hour ( ) Hour (Now) Minute ( ) Minute (Now) Second ( ) Second (Now) DateAdd ( ) Returns a date to which a specific interval has been added DateDiff ( ) Returns a Long data type value specifying the interval between the two values DatePart ( ) Returns an Integer containing the specified part of a given date DateValue ( ) Converts a string to a Date
TimeValue ( ) Converts a string to a time DateSerial ( ) Returns a date for specified year, month and day
Unit II Part C (10 Marks)
1. Explain the string function in visual basic. Functions Description Asc Returns an Integer value representing the character code corresponding to a character. Chr Returns the character associated with the specified character code. InStr Returns an integer specifying the start position of the first occurrence of one string within another. InStrRev Returns the position of the first occurrence of one string within another, starting from the right side of the string. Join Returns a string created by joining a number of substrings contained in an array. LCase Returns a string or character converted to lowercase. Left Returns a string containing a specified number of characters from the left side of a string. Len Returns an integer that contains the number of characters in a string. LTrim Returns a string containing a copy of a specified string with no leading spaces. Mid Returns a string containing a specified number of characters from a string. Replace Returns a string in which a specified substring has been replaced with another substring a specified number of times. Right Returns a string containing a specified number of characters from the right side of a string. RTrim Returns a string containing a copy of a specified string with no trailing spaces. Space Returns a string consisting of the specified number of spaces. Split Returns a zero-based, one-dimensional array containing a specified number of substrings. StrComp Returns -1, 0, or 1, based on the result of a string comparison. Trim Returns a string containing a copy of a specified string with no leading or trailing spaces. UCase Returns a string or character containing the specified string converted to uppercase. 2. Explain in detail about Function Procedures. A Function procedure is a series of Visual Basic statements enclosed by the Function and End Function statements. The Function procedure performs a task and then returns control to the calling code. When it returns control, it also returns a value to the calling code. Each time the procedure is called, its statements run, starting with the first executable statement after the Function statement and ending with the first End Function, Exit Function, or Return statement encountered.
x = Val(TxtNum1.Text) y = Val(TxtNum2.Text) sum x, y End Sub Sub sum(a As Single, b As Single) MsgBox ("sum=" & a + b) End Sub
1. What is meant by object?explain An object is a combination of code and data that can be treated as a unit. An object can be a piece of an application, like a control or a form. An entire application can also be an object. 2. What is the use of refresh methos? Forces a complete repaint of a form or control. 3. List down the properties of line control. BorderColor (the color of the line) BorderStyle (the same as a form's DrawStyle property) BorderWidth (the same as a form's DrawWidth property) and DrawMode.
**UNIT 3 PART C (10 MARKS)