0% found this document useful (0 votes)
756 views5 pages

Describe The Process of Compiling and Running A Visual Basic Application

The document describes various concepts related to Visual Basic .NET and XML including: 1. The process of compiling and running a Visual Basic application including creating a project, compiling source code to intermediate language, storing the output in an assembly, and running the assembly using the Common Language Runtime. 2. Basic data types and variables in Visual Basic .NET including value types, reference types, implicit and explicit data types, and how variables are declared and initialized. 3. The differences between single document interfaces (SDI) which show each form in its own window, and multi-document interfaces (MDI) which contain child forms within a parent container form. 4. Exception handling in the .NET environment

Uploaded by

gohil_devendra07
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
756 views5 pages

Describe The Process of Compiling and Running A Visual Basic Application

The document describes various concepts related to Visual Basic .NET and XML including: 1. The process of compiling and running a Visual Basic application including creating a project, compiling source code to intermediate language, storing the output in an assembly, and running the assembly using the Common Language Runtime. 2. Basic data types and variables in Visual Basic .NET including value types, reference types, implicit and explicit data types, and how variables are declared and initialized. 3. The differences between single document interfaces (SDI) which show each form in its own window, and multi-document interfaces (MDI) which contain child forms within a parent container form. 4. Exception handling in the .NET environment

Uploaded by

gohil_devendra07
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

BC0053 VB.

NET & XML Gohil Devendrasinh ASSIGNMENT SET 1

1. Describe the process of compiling and running a visual Basic application.


Ans: To start, you use Visual Studio .NET to create a project, which is made of one or more source files that contain Visual Basic statements. Most simple projects consist of just one source file, but more complicated projects can have more than one source file. A project may also contain other types of files, such as sound files, image files, or simple text files. As the figureshows, a solution is a container for projects, which youll learn more about in a moment.You use the Visual Basic compiler, which is built into Visual Studio, to compile your Visual Basic source into Microsoft Intermediate Language. For short, this can be referred to as Intermediate Language (or IL).At this point the Intermediate Language is stored on disk in a file thats called an assembly. Inaddition to the IL, the assembly includes references to the classes that the application requires.The assembly can then be run on any PC that has the Common Language Runtime installed on it.When the assembly is run, the CLR converts the Intermediate Language to native code that canbe run by the Windows Operating System. CLR is available for Unix System also, i.e. Mono. It is possible that the CLR will eventually be available for other operating systems as well. In other words, the Common Language Runtime makes platform independence possible. Visual Basic applications will be able to run on those operating systems as well as Windows/Unix operating systems. Whether this will happen and how well it will work remains to be seen.

2. Explain various basic data types and variables in visual.


Ans: `There are two kinds of data types in VB.Net

(i) Value type (implicit data types, Structure and Enumeration) (ii) Reference Type (objects,delegates) Value types are passed to methods by passing an exact copy while Reference types are passed to methods by passing only their reference (handle), Implicit data types are defined in the language core by the language vendor, while explicit data types are types that are made by using or composing implicit data types. As seen in the first unit, implicit data types in .net compliant languages are mapped to types in Common Type System (CTS) and CLS(Common Language Specification). Hence, each implicit data type in VB.Net has its corresponding .Net type. The implicit data types in VB.Net are:

BC0053 VB.NET & XML Gohil Devendrasinh

Implicit data types are represented in language using keywords; so each of above is a keyword in VB.Net (keyword are the words defined by the language and can not be used as identifiers). It is worthnoting that string is also an implicit data type in VB.Net, so String is a keyword in VB.Net. Last point about implicit data types is that they are value types and thus stored at the stack, while user defined types or referenced types are stored at heap. Stack is a data structure that store items in last in first out (LIFO) fashion. It is an area of memory supported by the processor and its size is determined at the compile time. Heap is the total memory available at run time. Reference types are allocated at heap dynamically (during the execution of program). Garbage collector searches for non-referenced data in heap during the execution of program and returns that space to Operating System. Variables During the execution of program, data is temporarily stored in memory. A variable is the name given to a memory location holding particular type of data. So, each variable has associated with it a data type and value. In VB.Net, a variable is declared as: Dim<variable> as <data type> Example: Dim I As Integer The above line will reserve an area of 4 bytes in memory to store integer type values, which will be referred in the rest of program by identifier i. You can initialize the variable as you declare it (on the fly) and can also declare/initialize multiple variables of same type in a single statement. Examples: Dim isReady As Boolean = True Dim percentage = 87.88, average = 42.5 As Single

BC0053 VB.NET & XML Gohil Devendrasinh Dim digit As Char = 8c

3. With the help of suitable example, describe the development of single document and multi-document interface.
Ans. With the example of the two versions of the Financial Calculations application, we can describe the development of single document and multi-document interface.These applications let the user calculate an investment or depreciation using forms. Also, each application includes a third form that provides a way for the user to access the other forms. Single Document Interface: In an SDI application, each form runs in its own application window, and this window is usually shown in the Windows taskbar. To switch between the open forms, the taskbar buttons are clicked. In this interface, each form can have its own menus and tools. A main form called startup form provides access to other forms.eg.Fig. SDI

Multi-Document Interface: In an MDI application, a container form called a parent form contains one or more child forms. Then, the menus and toolbars on the parent form contains the commands thatmake opening and viewing of forms possible. Its Window menu is used to switch between the open forms. When the parent form is closed, all of its child forms are closed.

BC0053 VB.NET & XML Gohil Devendrasinh

4. Describe the concept of exception in .Net environment.


Ans. Exception in .NET: The common language runtime in .NET does not error codes. When an unexpected condition occurs, the CLR creates a special object called an exception. This object contains properties and methods that describe the unexpected condition in detail and communicate various items of information about what went wrong. This is why, instead of using error handling, .NET uses the term 'exception handling'. It refers to the techniques used in .NET to detect exceptions and take appropriate actions..NET implements a systemwide, comprehensive approach to exception handling. The exception object containing error information, is an instance of a class that derives from a class name System.Exception. A variety of subclasses of System.Exception are used for different circumstances. Exception Handling Keywords: Some keywords are used in exception handling like: 1.Try: Begin a section of code that might contain the error code. The exception is automatically routed to the Catch block. 2.Catch: Begins an exception handler for a type of exception. One or more Catch block follow a try block and each catch block handles different exceptions. 3.Finally: It contains codes that must be run regardless of the exception detected.. Typically, it is used to close or dispose of any resources that might have been left unresolved by the error code. 4.Throw: It generates an exception. It is usually done in a Catch block when the exception should be kicked back to a calling routine or in a routine that has itself detected an error.

5. Explain the concept of setting a connection string with example.


Ans: There are Properties and Methods associated with the Connection Object, of course. We want to start with the Connection String Property. This can take MANY parameters. Fortunately, we only need a few of these. We need to pass two things to our new Connection Object: the technology we want to use to do the connecting to our database; and where the database is. (If your database was password and user name protected, you would add these two parameters as well. Ours isnt, so we only need the two.) The technology is called the Provider; and you use Data Source to specify where your database is. This should be entered on the same line, and not two as it is below. So add this to your code:Con.ConnectionString = PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=C:\AddressBook.mdb Notice the two parts, separated by a semi-colon: 1st part: PROVIDER=Microsoft.Jet.OLEDB.4.0 2nd

BC0053 VB.NET & XML Gohil Devendrasinh Part: Data Source = c:\AddressBook.mdb The first part specifies which provider technology we want to use to do the connecting (JET). The second part, typed after a semi-colon, points to where the database is. In the above code, the database is on the C drive, in the root folder. The name of the Access file we want to connect to is called AddressBook.mdb. (Note that Data Source is two words, and not one.) But your coding window should now look like this: Private Sub btnLoad_Click(ByVal sender as Object,_ By Val e as System.EventArgs)_ Handles btnLoad.Click Dim con as new OleDb.OleDbConnection Con.ConnetionString = Provider = Microsoft.Jet.Oledb.4.0; DataSource = C:\AddressBook.mdb This assumes that you have copied the AddressBook database over to the root folder of your C Drive. If youve copied it to another folder, change the Data Source part to match. For example, if you copied it to a folder called databases youd put this: Data Source = C:\databases\AddressBook.mdb In our code, though, ConnectionString is a property of the con variable. The con variable holds our Connection Object. Were passing the Connection String the name of a data provider, and a path to the database.

You might also like