WEEK 1. Event: Tick: Occurs when the specified timer interval has elapsed and the timer is enabled.

Size: px
Start display at page:

Download "WEEK 1. Event: Tick: Occurs when the specified timer interval has elapsed and the timer is enabled."

Transcription

1 WEEK 1 Timer: A Timer is used to raise an event at user-defined intervals. It is optimized for use in Windows Forms applications. Timer is used to control and manage events that are time related. For example: You need a timer to create a clock, a stop watch, a dice etc. Properties: Enabled: Gets or Sets whether the Timer is running. When this property value is set to true at design time then the timer will start ticking when the program runs. Interval: Gets or Sets the time in milliseconds before the tick event is raised relative to the last occurrence of the tick event. Methods: Start: This method is used to start the timer. Stop: This method is used to stop the timer. Event: Tick: Occurs when the specified timer interval has elapsed and the timer is enabled. Timer Program 1: Public Class Form1 Private Sub Start_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Start_Button.Click Timer1.Start() Private Sub Stop_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Stop_Button.Click Timer1.Stop()

2 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label1.Text = TimeOfDay Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Interval = 1000 Timer Program 2: Public Class Form1 Private Sub timer1_tick(byval sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label1.Text = TimeOfDay If Label1.BackColor = Color.Yellow Then Label1.BackColor = Color.Blue Else Label1.BackColor = Color.Yellow End If Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Interval = 1000 Private Sub Start_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Start_Button.Click Timer1.Start() Private Sub Stop_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Stop_Button.Click Timer1.Stop()

3 Timer Program 3 (Stop Watch): Public Class Form1 Private Sub Start_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Start_Button.Click Timer1.Start() Private Sub Stop_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Stop_Button.Click Timer1.Stop() Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label1.Text = Val(Label1.Text) + 1 Private Sub Reset_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Reset_Button.Click Label1.Text = 0

4 Timer Program 4: Stop Watch 2 Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Interval = 1000 Private Sub Start_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Start_Button.Click Timer1.Start() Private Sub Stop_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Stop_Button.Click Timer1.Stop() Private Sub Reset_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Reset_Button.Click TextBox1.Text = "00" TextBox2.Text = "00" TextBox3.Text = "00"

5 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If TextBox3.Text = "59" Then TextBox3.Text = "00" If TextBox2.Text = "59" Then TextBox1.Text = Val(TextBox1.Text) + 1 TextBox2.Text = "00" Else TextBox2.Text = Val(TextBox2.Text) + 1 End If Else TextBox3.Text = Val(TextBox3.Text) + 1 End If Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Interval = 1000 Progress Bar: It is used to provide visual feedback to your users about the status of some task. It shows the bar that fills in form left to right as the operation progresses. The progress bar control is typically used when an application performs tasks such as copying files or printing documents. To a user the application might look unresponsive if there is no visual clue. In such cases, using the progress bar allows the programmer to provide visual status of progress. Properties: Minimum: Gets or Sets the minimum value of the range of the control. Maximum: Gets of sets the maximum value of the range of the control. Step: Gets or Sets the amount by which a call to the PerformStep method increases the current position of the progress bar. Value: Gets or Sets the current position of the progress bar. ForeColor: Gets or Sets the foreground color of the control.

6 Progress Bar Program 1: Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Progressbar1 As New ProgressBar ProgressBar1.Location = New Point(20, 20) Progressbar1.Minimum = 0 Progressbar1.Maximum = 100 Progressbar1.Value = 75 Me.Controls.Add(ProgressBar1)

7 Progress Bar Program 2: Public Class Form1 Private Sub Fill_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Fill_Button.Click Dim i As Integer For i = 1 To 100 ListBox1.Items.Add(i) ProgressBar1.Value = i Next Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ProgressBar1.Minimum = 1 ProgressBar1.Maximum = 100 ProgressBar1.ForeColor = Color.Blue

8 Progress Bar Program 3: Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ProgressBar1.Minimum = 0 ProgressBar1.Maximum = 100 Private Sub Start_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Start_Button.Click Timer1.Start() Button1.Enabled = False Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick ProgressBar1.Step = 1 ProgressBar1.PerformStep() If ProgressBar1.Value = ProgressBar1.Maximum Then Timer1.Stop() End If Label2.Text = ProgressBar1.Value & "% Completed"

9 WEEK 2 MDI: It s a rare program that has only one form in it. Mostly programs have more than one forms. Multiple Document Interface (MDI) applications enable you to display multiple documents at the same time, with each document displayed in its own window. VB.NET let s you add as many forms as you want to your project. MDI Parent Form: To create MDI Parent form select form and from the properties window set the IsMDIContainer property to true. This designates the form as an MDI container for child windows. MDI Child Form: MDI Child Form is an essential element of Multiple Document Interface (MDI) Applications as these forms are the center of user interaction. MDI Child Form is a normal form like any other form, the difference is the way you show it. Program 1: Public Class Form1 Dim objchildform As New Form2 Private Sub Form1_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Form1_Button.Click objchildform.mdiparent = Me objchildform.show()

10 Modal Form: A modal from is one that has to be dealt with before a user can continue. An example is the Change Case dialogue box in Microsoft Word. If you try to click away from the dialogue box, you will hear a beep to indicate an error. Until you click either the Cancel or OK buttons, the program won't let you click anywhere else. A Modal form is sometimes called a dialogue box. To display a form as a Modal dialogue box, you use the ShowDialog method. Modaless Form: These are forms than can be hidden or sent to the taskbar. You can then return to the main form or program and do things with it. The second form you've just created in program 1 is called a Modeless form. If you use the Show method, the form is displayed as a Modeless form. Program 2: Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim SecondForm As New Form2 If SecondForm.ShowDialog() = DialogResult.OK Then MsgBox("OK Button Clicked") Else MsgBox("Cancel Button Clicked") End If

11 Public Class Form2 Private Sub Ok_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Ok_Button.Click Me.DialogResult = Windows.Forms.DialogResult.OK Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click Me.DialogResult = Windows.Forms.DialogResult.Cancel

12 Program 3: Public Class Form1 Dim SecondForm As New Form2 Public tb As TextBox Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load tb = TextBox1 Private Sub ChangeText_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ChangeText_Button.Click SecondForm.ShowDialog()

13 Public Class Form2 Private Sub Ok_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Ok_Button.Click Dim ChangeCase As String ChangeCase = Form1.tb.Text If RadioButton1.Checked = True Then ChangeCase = ChangeCase.ToUpper ElseIf RadioButton2.Checked = True Then ChangeCase = ChangeCase.ToLower ElseIf RadioButton3.Checked = True Then ChangeCase = StrConv(ChangeCase, VbStrConv.ProperCase) End If Form1.tb.Text = ChangeCase Me.Close() Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click Me.DialogResult = Windows.Forms.DialogResult.Cancel When the Change Text button on Form1 is clicked, the dialogue box above will display. You can then select a Radio button to change the case to Upper, Lower or Proper case. This will happen when the OK button is clicked. Whatever text is in Texbox1 on Form1 will be changed accordingly.

14 Adding Menus to MDI: In VB.NET MenuStrip control is used for designing menus. You can use the toolbox to add a MenuStrip control to your form. The MenuStrip control object appears in the system tray. Shortcut keys for the menu items are added using the Shortcutkeys property. Program 4: Public Class Form1 Private Sub NewToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem.Click Dim childobj As New Form childobj.show() Private Sub QuitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles QuitToolStripMenuItem.Click Me.Close() Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click TextBox1.Cut() Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click TextBox1.Copy() Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click TextBox1.Paste()

15 Private Sub ClearToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ClearToolStripMenuItem.Click TextBox1.Clear()

16 WEEK 3 You can use the directory class for typical operations such as creating, deleting and moving directories. Because of the static nature of the Directory class, we do not have to instantiate the class. We can call the methods in the class directly from the directory class. Program 1: Program to create, delete and move directory Imports System.IO Public Class Form1 Private Sub CreateDirectory_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateDirectory_Button.Click If System.IO.Directory.Exists("D:\Folders\one") = True Then MsgBox(" Directory Already Exist ") Else Directory.CreateDirectory("D:\Folders\one") MsgBox(" Directory Created ") End If Private Sub DeleteDirectory_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteDirectory_Button.Click If System.IO.Directory.Exists("D:\Folders\one") = False Then MsgBox(" Directory Does Not Exist ") Else Directory.Delete("D:\Folders\one", True) MsgBox(" Directory Deleted ") End If

17 Private Sub MoveDirectory_Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MoveDirectory_Button.Click If System.IO.Directory.Exists("D:\Folders\one") = False Then MsgBox(" Source Directory Does Not Exist ") Else Directory.Move("D:\Folders\one", "D:\Folders\two") MsgBox(" Directory Moved ") End If Program 2: Program to create and delete directory. Imports System.IO Public Class Form1 Private Sub CreateDirectory_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CreateDirectory_Button.Click If System.IO.Directory.Exists(ComboBox1.SelectedItem & TextBox1.Text) = True Then MsgBox(" Directory Named " & TextBox1.Text & " Already Exist ") Else Directory.CreateDirectory(ComboBox1.SelectedItem & TextBox1.Text) MsgBox(" Directory Named " & TextBox1.Text & " Created ") End If Private Sub DeleteDirectory_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteDirectory_Button.Click If System.IO.Directory.Exists(ComboBox1.SelectedItem & TextBox1.Text) = False Then MsgBox(" Directory Named " & TextBox1.Text & " Does not Exist ") Else Directory.Delete(ComboBox1.SelectedItem & TextBox1.Text, True) MsgBox(" Directory Named " & TextBox1.Text & " Deleted ") End If

18 Program 3:Program to copy a file. Imports System.IO Public Class Form1 Private Sub CopyFile_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyFile_Button.Click If System.IO.File.Exists(ComboBox1.SelectedItem & TextBox1.Text) = True Then File.Copy(ComboBox1.SelectedItem & TextBox1.Text, ComboBox2.SelectedItem & TextBox1.Text) MsgBox(" File Copied ") Else MsgBox(" File does not exist ") End If

19 Program 4:Program to delete a file. Imports System.IO Public Class Form1 Private Sub DeleteFile_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeleteFile_Button.Click If System.IO.File.Exists(ComboBox1.SelectedItem & TextBox1.Text) = True Then File.Delete(ComboBox1.SelectedItem & TextBox1.Text) MsgBox(" File deleted ") Else MsgBox(" File does not exist ") End If

20 Program 5: Program to rename a file. Public Class Form1 Private Sub RenameFile_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RenameFile_Button.Click If System.IO.File.Exists(ComboBox1.SelectedItem & TextBox1.Text) = True Then My.Computer.FileSystem.RenameFile(ComboBox1.SelectedItem & TextBox1.Text, TextBox2.Text) MsgBox(" file named " & TextBox1.Text & " renamed to " & TextBox2.Text) Else MsgBox(" File named " & TextBox1.Text & " does not exist ") End If

21 WEEK 4 Graphics: In VB.NET the programmer needs to write code to create various shapes and drawings. Even though the learning curve is steeper, the programmer can write powerful code to create all kinds of graphics. You can even design your own controls. VB.NET offers various graphics capabilities that enable programmers to write code that can draw all kinds of shapes and even fonts. Creating the Graphics Object: Before you can draw anything on a form, you need to create the Graphics object. A graphics object is created using a CreateGraphics() method. Draw Line: Public Class Form1 Private Sub DrawLine_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DrawLine_Button.Click Dim g As Graphics g = Me.CreateGraphics Dim mypen As New Pen(Color.Black) g.drawline(mypen, 10, 10, 100, 10)

22 Draw Rectangle: Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim g As Graphics g = Me.CreateGraphics Dim mypen As New Pen(Color.Black) g.drawrectangle(mypen, 10, 10, 100, 50)

23 Draw Ellipse: Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim g As Graphics g = Me.CreateGraphics Dim mypen As New Pen(Color.Black) Dim mybrush As New SolidBrush(Color.Red) g.drawellipse(mypen, ClientRectangle) g.fillellipse(mybrush, ClientRectangle)

24 Line, Rectangle and Ellipse: Public Class Form1 Dim g As Graphics Dim mypen As New Pen(Color.Black) Dim mybrush As New SolidBrush(Color.Red) Private Sub DrawLine_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DrawLine_Button.Click g = Me.CreateGraphics g.drawline(mypen, 10, 10, 100, 10) Private Sub DrawRectangle_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DrawRectangle_Button.Click g.drawrectangle(mypen, 120, 10, 150, 50) Private Sub DrawEllipse_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DrawEllipse_Button.Click g.drawellipse(mypen, 350, 10, 50, 100) Private Sub FillEllipse_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FillEllipse_Button.Click g.fillellipse(mybrush, 350, 10, 50, 100)

25 Notify Icon: Icons in the notification area are shortcuts to processes that are running in the background of a computer such as a virus protection program or a volume control. These processes do not come with their own user interfaces. The NotifyIcon class provides a way to program in this functionality. The Icon property defines the Icon that appears in the notification area. Pop-up menus for an icon are addressed with the ContextMenu property. Properties: Icon: This property is used to get/set the Icon. Visible: Gets or sets a value indicating whether the icon is visible in the notification area of the task bar. ContextMenuStrip: Gets or sets the shortcut menu associated with the notify icon. Text: Gets or sets the ToolTip text displayed when the mouse pointer rests on a notification area icon. Method: showbaloontip: Displays a balloon tip with the specified title, text and icon in the taskbar for the specified time period. ContextMenuStrip: The ContextMenuStrip control represents a shortcut menu that pops up over controls, usually when you right click them. They appear in context of some specific controls so are called ContextMenuStrip. This control associates the context menu with other menu items by setting that menu item s ContextMenuStrip property to the ContextMenuStrip control you designed. Program 1:

26 Public Class Form1 Private Sub HideForm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HideForm_Button.Click Me.Visible = False Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize If Me.WindowState = FormWindowState.Minimized Then Me.Visible = False NotifyIcon1.Visible = True NotifyIcon1.ShowBalloonTip(30000, "NotifyIcon", "Running Minimized", ToolTipIcon.Info) End If Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick Me.Visible = True Me.WindowState = FormWindowState.Normal NotifyIcon1.Visible = False Private Sub ShowFormToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShowFormToolStripMenuItem.Click Me.Visible = True Me.WindowState = FormWindowState.Normal NotifyIcon1.Visible = False

27 Private Sub CloseFormToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseFormToolStripMenuItem.Click Me.Close() Program 2: Public Class Form1 Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click TextBox1.Cut() Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click TextBox1.Copy()

28 Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click TextBox1.Paste()

29 WEEK 6 Gaining access to SQL Server 2005 Express When you open Management Studio Express, a connection window with SQL Server will be opened, as Figure 1 shows. In this window, you will enter the data for connection with SQL Express existent in your machine. A detail to be observed is that you can, through the Management Studio, connect to a server SQL Server which is in another machine in the net. Just click in the Server name box and choose the Browser for more option to search for the other server. In our example, we will connect to the existing SQLEXPRESS instance in the machine itself (that, in this case, has the name PND). Figure 1. Connection window of the SQL Management Studio Express

30 Management Studio Work Area After connected, the work area of Management Studio Express is then presented, as Figure 2 shows. This window possesses the following areas: Menu Bar, Toolbar, Object Explorer and Active Files. Figure 2. SQL Server Management Studio Express Work Area Through the Object Explorer box we can navigate among all of the SQL Server parts, especially the Databases folder, where the created databases and their objects are contained (tables etc.). In order to create a new database, it is enough to right-click over the Databases folder and choose the New Database option. The window for the creation of the database is then opened, where you insert the name, choose the owner and configure the initial size of the data and log files. In our example, we call our new database Library and leave the initial data file size at 3 MB, as you can verify in Figure 3. After performing all the actions, click the OK button to finish our database creation.

31 Figure 3. The New Database Window Creating tables Created the database, we will visualize and add the desired table. To visualize our database s folders, we will expand the Databases objects and, after that, Library, through the Object Explorer. Once the database is open, the following folders structure is presented: Database Diagrams: The entity-relationship diagrams are stored in this location; Tables: Folder where the database tables are stored; Views: Here stay all the views that have been created; Synonyms: Directory of the synonymous that have been created;

32 Programmability: Place where you set all of the database s programming: stored procedures, function, rules etc; Security: In this last item, you set all the security parameters, such as Users, Schemes, Certificates, etc. We will begin by creating the Books table. To create a table, click the right hand button over Tables and choose the New Table option. The new table s data structure then opens as shown in Figure 4. Figure 4. Creating a table To insert a field, you must write the name of the column, choose the kind of data and examine if it will accept null values. After, with the new field selected, you will be able to set all its properties in the Column Properties box. Amongst the existing properties, we can highlight the Identity Specification option, where you can attribute the identity property and set the auto increment of the field, as shown in Figure 4. To attribute a primary key to a field, just select it and click the Set Primary Key button located in the Table

33 Designer toolbar. To finish the creation of the Books table, just click over the X in the right hand side of the table structure window. The Management Studio Express asks if you wish to save this table and what name should be attributed to this new object. Once it is saved, the table begins to appear in the list of the Tables folder. Database and Table Creation using Query: CREATE DATABASE LIBRARY ON PRIMARY ( NAME = 'LIBRARY', FILENAME = 'D:\LIBRARY.mdf', SIZE = 2048KB, MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB ) LOG ON ( NAME = 'LIBRARY_log', FILENAME = 'D:\LIBRARY_log.ldf', SIZE = 1024KB, MAXSIZE = UNLIMITED, FILEGROWTH = 10% ) create table Books ( BookId int identity(1,1) not null primary key, Author varchar(50) not null, Title varchar(200) not null, )

34 WEEK 7 DML: DML is abbreviation of Data Manipulation Language. It is used to retrieve and modify data in database. These commands will be used by all database users during the routine operation of the database. Let's take a brief look at the basic DML commands. INSERT: The INSERT command in SQL is used to add records to an existing table. Let suppose we have created a table named Student and the student table contains columns such as RNo, Name and Marks, let's imagine that we need to add a new student to the table. We can use a command similar to the one shown below: Insert into student values(5, ALI, 70) Note that there are three values specified for the record. These correspond to the table attributes in the order they were defined: RNo, Name and Marks. We can also write the above query as: Insert into student(rno, name, marks) values(5, ALI,70) SELECT: The SELECT command is the most commonly used command in SQL. It allows database users to retrieve the specific information they desire from an operational database. Let's take a look at a few examples, again using the student table. The command shown below retrieves all of the information contained within the student table. Note that the asterisk is used as a wildcard in SQL. This literally means "Select everything from the student table." select * from student

35 Alternatively, users may want to limit the attributes that are retrieved from the database. For example, you may require a list of the names of all students in the table. The following SQL command would retrieve only that information: select name from student The WHERE clause can be used to limit the records that are retrieved to those that meet specified criteria. You might be interested in retrieving the records of the students whose marks are greater than 50. The following command retrieves all of the data contained within student table for records that have marks value greater than 50: select * from student where marks > 50 To select the record of students whose name starts with A we can use the following query select * from student where name like a% To select the record of students whose name ends with S we can use the following query select * from student where name like %s To select the record of students whose name starts with A and ends with S we can use the following query select * from student where name like a%s To select the record of students whose name contain character A we can use the following query select * from student where name like %a%

36 UPDATE: The UPDATE command can be used to modify information contained within a table, either in bulk or individually. To change the marks of a student we can use the query as: update student set marks = 50 where rno = 2 In order to update multiple records at a time we can use the query as: update student set marks = marks + 10 DELETE: The syntax of the delete command is similar to that of the other DML commands. For example if we want to delete the record of a student from our table. The DELETE command with a WHERE clause can be used to remove the record from the student table: delete from student where rno = 5 To delete group of records, if we want to delete the record of students whose marks are less than 50 than we can write the query as delete from student where marks < 50 Now to Delete the entire table we can use the following query: Drop table student

37 WEEK 8 SQL JOIN: An SQL JOIN clause is used to combine rows from two or more tables, based on a common field between them. We have created two tables such as Orders and Customer. The attributes of Orders table are OrderId, CustomerId and OrderDate whereas the attributes of Customer table are CustomerId, CustomerName. SQL Join statements will be used to retrieve data from these two tables. Cross Join: Each row from the left table is combined with all rows from the right table. Cross joins are also called Cartesian products. The size of the Cartesian product result set is the number of rows in the first table multiplied by the number of rows in the second table. select * from orders cross join customer Inner Join: The most common type of join is Inner Join. An SQL INNER JOIN return all rows from multiple tables where the join condition is met. The INNER JOIN keyword selects all rows from both tables as long as there is a match between the columns in both tables. SQL INNER JOIN Syntax SELECT column_name(s) FROM table1 INNER JOIN table2 ON table1.column_name=table2.column_name;

38 Example: SELECT orders.orderid,customer.customername, orders.orderdate FROM Orders INNER JOIN Customer ON Orders.CustomerID=Customer.CustomerID Left Outer Join: The LEFT OUTER JOIN keyword returns all rows from the left table (table1), with the matching rows in the right table (table2). The result is NULL in the right side when there is no match. Syntax SELECT column_name(s) FROM table1 LEFT OUTER JOIN table2 ON table1.column_name=table2.column_name; Example The following SQL statement will return all customers, and any orders they might have: SELECT Customer.CustomerName, Orders.OrderID FROM Customer LEFT OUTER JOIN Orders ON Customer.CustomerID=Orders.CustomerID ORDER BY Customer.CustomerName

39 Right Outer Join: The RIGHT OUTER JOIN returns all rows from the right table (table2), with the matching rows in the left table (table1). The result is NULL in the left side when there is no match. Syntax SELECT column_name(s) FROM table1 RIGHT OUTER JOIN table2 ON table1.column_name=table2.column_name; Example select customer.customername, orders.orderid from customer right outer join orders on customer.customerid = orders.customerid order by orders.orderid SQL FULL OUTER JOIN: The FULL OUTER JOIN keyword returns all rows from the left table (table1) and from the right table (table2). The FULL OUTER JOIN keyword combines the result of both LEFT and RIGHT joins. SQL FULL OUTER JOIN Syntax SELECT column_name(s) FROM table1 FULL OUTER JOIN table2 ON table1.column_name=table2.column_name;

40 Example The following SQL statement selects all customers, and all orders: select customer.customername, orders.orderid from customer full outer join orders on customer.customerid = orders.customerid Note: The FULL OUTER JOIN keyword returns all the rows from the left table (Customers), and all the rows from the right table (Orders). If there are rows in "Customers" that do not have matches in "Orders", or if there are rows in "Orders" that do not have matches in "Customers", those rows will be listed as well.

41 WEEK 9 STORED PROCEDURES: A stored procedure is nothing more than prepared SQL code that you save so you can reuse the code over and over again. So if you think about a query that you write over and over again, instead of having to write that query each time you would save it as a stored procedure and then just call the stored procedure to execute the SQL code that you saved as part of the stored procedure. In addition to running the same SQL code over and over again you also have the ability to pass parameters to the stored procedure, so depending on what the need is the stored procedure can act accordingly based on the parameter values that were passed. Uses of Stored Procedures: 1) Reduces network traffic 2) Returns information to the caller 3) Modify data in the database. Creating a simple stored procedure: Before you create a stored procedure you need to know what your end result is, whether you are selecting data, inserting data, etc. In this simple example we will just select all data from the Student table. So the simple SQL code would be as follows which will return all rows from this table. Select * from Student To create a stored procedure to do this the code would look like this:

42 Create Procedure std As begin Select * from Student end GO To call the procedure to return the contents from the table specified, the code would be: Execute std When creating a stored procedure you can either use CREATE PROCEDURE or CREATE PROC. After the stored procedure name you need to use the keyword "AS" and then the rest is just the regular SQL code that you would normally execute. One thing to note is that you cannot use the keyword "GO" in the stored procedure. Once the SQL Server compiler sees "GO" it assumes it is the end of the batch. If we want to modify the above created procedure and we want to select only name and marks instead of all columns then we can modify it as: alter procedure std as select name, marks from student go How to create a SQL Server stored procedure with parameters: The real power of stored procedures is the ability to pass parameters and have the stored procedure handles the differing requests that are made. Just like you have the ability to use parameters with your SQL code you can also setup your stored procedures to accept one or more parameter values. One Parameter: In this example we will query the Student table, but instead of getting back all records we will limit it to just a specific roll number. create procedure int as select * from student where rno go

43 To call this stored procedure we would execute it as follows: exec = 2 We can also do the same thing, but allow the users to give us a starting point to search the data. Here we can change the "=" to a LIKE and use the "%" wildcard. create procedure varchar(20) as select * from student where sname + '%' go To call this stored procedure we would execute it as follows: execute = ali or exec std ali In both of the proceeding examples it assumes that a parameter value will always be passed. If you try to execute the procedure without passing a parameter value you will get an error message Default Parameter Values: In most cases it is always a good practice to pass in all parameter values, but sometimes it is not possible. So in this example we use the NULL option to allow you to not pass in a parameter value. If we create and run this stored procedure as is it will not return any data, because it is looking for any student name values that equal NULL. create procedure varchar(20) = NULL as select * from student where sname + % GO To call this stored procedure we would execute it as follows:

44 execute = ali We could change this stored procedure and use the ISNULL function to get around this. So if a value is passed it will use the value to narrow the result set and if a value is not passed it will return all records. create procedure varchar(20) = NULL as select * from student where sname like isnull(@stdname,sname) + % GO To call this stored procedure we would execute it as follows: execute = ali Multiple Parameters: Setting up multiple parameters is very easy to do. You just need to list each parameter and the data type separated by a comma as shown below. create procedure varchar(20) = varchar(20) = null as select * from student where sname like isnull(@stdname,sname) + '%' and fname like isnull(@fathname,fname) + '%' go To call this stored procedure we would execute it as follows: Execute = = bilal

45 WEEK 10 to 15 ADO.NET: VB.Net allows you many ways to connect to a database or a data source. The technology used to interact with a database or data source is called ADO.NET. The ADO parts stands for Active Data Objects. ADO.NET libraries appear under System.Data namespace. Datasharing consumer applications can use ADO.NET to connect to these data sources and retrieve, handle, and update the data that they contain. ADO.NET includes.net Framework data providers for connecting to a database, executing commands, and retrieving results. ADO.NET provides the most direct method of data access within the.net Framework. OLE DB Connection: The Connection Object is what you need if you want to connect to a database. OLE DB stands for Object Linking and Embedding Database and it is basically a lot of objects bundled together that allow you to connect to data sources in general, and not just databases. Dim cn As New OleDb.OleDbConnection The variable cn will now hold the Connection Object. Notice that there is a full stop after the OleDB part. You'll then get a pop up box from where you can select OleDbConnection. We're also creating a New object on this line. This is the object that you use to connect to a database. Setting a Connection String: There are Properties and Methods associated with the Connection Object, of course. We want to start with the ConnectionString property. This can take many parameters. We need to pass few things to our new Connection Object: the technology we want to use for connecting to our database, server name and database name. (If your database was password and user name protected, you would add these two parameters as well.) cn.connectionstring = "provider=sqloledb;server=.\sqlexpress;database=student1;integrated security=sspi"

46 Opening and closing a Connection: Now that we have a ConnectionString, we can go ahead and open the datatbase. This is quite easy - just use the Open method of the Connection Object: cn.open() Once open, the connection has to be closed again. This time, just use the Close method: cn.close() Program 1: Connecting to SQL Server database using SqlConnection Class. Imports System.Data.SqlClient Public Class Form1 Dim con As New SqlConnection Private Sub Connect_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Connect_Button.Click Try con.connectionstring = "server=.\sqlexpress;database=sample;integrated security=sspi" con.open() Label2.Text = "connected" Catch ex As Exception MsgBox(ex.Message) End Try Private Sub Disconnect_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Disconnect_Button.Click con.close() Label2.Text = "disconnected"

47 Program 2: Connecting to SQLServer database using OledbConnection Class. Imports System.Data.OleDb Public Class Form1 Dim cn As New OleDbConnection Private Sub Connect_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Connect_Button.Click Try cn.connectionstring = "PROVIDER=SQLOLEDB;server=.\SQLEXPRESS;database=sample;integrated security=sspi" cn.open() Label2.Text = "Connected" Catch ex As Exception MsgBox(ex.Message) End Try Private Sub Disconnect_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Disconnect_Button.Click cn.close() Label2.Text = "disconnected" Program 3: Connecting to SQL Server using SQLServer Authentication Mode. Imports System.Data.OleDb Public Class Form1 Dim cn As New OleDbConnection Private Sub Connect_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Connect_Button.Click Try cn.connectionstring = "PROVIDER=SQLOLEDB;server=.\SQLEXPRESS;database=sample;UID=sa" cn.open() Label2.Text = "Connected" Catch ex As Exception MsgBox(ex.Message) End Try Private Sub Disconnect_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Disconnect_Button.Click cn.close() Label2.Text = "disconnected"

48 DataSet: ADO.NET uses something called a DataSet to hold all of your information from the database. The DataSet is not something you can draw on your form, like a Button or a Textbox. The DataSet is something that is hidden from you, and just stored in memory. Imagine a grid with rows and columns. Each imaginary row of the DataSet represents a Row of information in your database and each imaginary column represents a Column of information in your database. Data Adapter: The Connection Object and the DataSet can't see each other. They need a gobetween so that they can communicate. This go-between is called a Data Adapter. The Data Adapter contacts your Connection Object, and then executes a query that you set up. The results of that query are then stored in the DataSet. The Data Adapter and DataSet are objects. You set them up like this: Dim ds As New DataSet Dim da As OleDbDataAdapter da = New OleDb.OleDbDataAdapter( sql, con ) The third line creates a new Data Adapter object. You need to put two things in the round brackets of the Object declaration: Your SQL string, and your connection object. Our Connection Object is stored in the variable which we've called cn. You then pass the New Data Adapter to your variable (da for us): Filling the DataSet: The Data Adapter can Fill a DataSet with records from a Table. You only need a single line of code to do this: da.fill(ds, "std") As soon as you type the name of your Data Adapter (da for us), you'll get a pop up box of properties and methods. Select Fill from the list, then type a pair of round brackets. In between the round brackets, you need two things: the Name of your DataSet (ds, in our case), and an identifying name. This identifying name can be anything you like but it is just used to identify this particular Data Adapter Fill.

49 Add the new line after the creation of the Data Adaptor: da = New OleDb.OleDbDataAdapter(sql, con) da.fill(ds, "std") The DataSet (ds) will now be filled with the records we selected from the table called student1. Program 4: A program to use Dataset using SqlConnection class. Imports System.Data.SqlClient Public Class Form1 Private Sub ShowResult_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShowResult_Button.Click Dim cn As New SqlConnection Dim da As SqlDataAdapter Dim ds As New DataSet Dim sql As String Try cn.connectionstring = "server=.\sqlexpress;database=sample;integrated security=sspi" cn.open() sql = "select * from student1 where rno = " & Val(TextBox1.Text) da = New SqlDataAdapter(sql, cn) da.fill(ds, "std") cn.close() Catch ex As Exception MsgBox(ex.Message)

50 End Try TextBox2.Text = ds.tables("std").rows(0).item(1) TextBox3.Text = ds.tables("std").rows(0).item(2) Program 5: A program to use Dataset using OledbConnection class. Imports System.Data.Oledb Public Class Form1 Private Sub ShowResult_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShowResult_Button.Click Dim cn As New OledbConnection Dim da As OledbDataAdapter Dim ds As New DataSet Dim sql As String Try cn.connectionstring = "provider=sqloledb;server=.\sqlexpress;database=sample;integrated security=sspi" cn.open() sql = "select * from student1 where rno = " & Val(TextBox1.Text) da = New OledbDataAdapter(sql, cn) da.fill(ds, "std") cn.close() Catch ex As Exception MsgBox(ex.Message) End Try TextBox2.Text = ds.tables("std").rows(0).item(1) TextBox3.Text = ds.tables("std").rows(0).item(2) OledbCommand: OledbCommand is used to execute different types of queries. SelectCommand, InsertCommand, UpdateCommand and DeleteCommand are the properties of OledbCommand class that we will use in our programs. The syntax to create an object of OledbCommand is: Dim dc as new OledbCommand( query/procedure,connection object)

51 Program 6: Program to use OledbCommand Imports System.Data.OleDb Public Class Form1 Dim cn As New OleDbConnection Dim dr As OleDbDataReader Dim dc As New OleDbCommand Dim sql As String Dim marks As Integer Dim name As String Private Sub ShowResult_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ShowResult_Button.Click Try cn.connectionstring = "provider=sqloledb;server=.\sqlexpress;database=sample;integrated security=sspi" cn.open() sql = "select * from student1 where rno = " & Val(TextBox1.Text) dc = New OleDbCommand(sql, cn) dr = dc.executereader() If dr.read Then name = dr(1) marks = dr(2) End If cn.close() Catch ex As Exception MsgBox(ex.Message) End Try TextBox2.Text = name TextBox3.Text = marks Datagrid View: The DataGridView control provides a customizable table for displaying data. This control is designed to be a complete solution for displaying tabular data with Windows Forms. Also the DataGridView class allows us to customization of cells, rows, columns, and borders through the use of its properties You can extend the DataGridView control in a number of ways to build custom behaviors into your applications. The DataGridView control makes it easy to define the basic appearance of cells and the display formatting of cell values. The cell is the fundamental unit of interaction for the DataGridView.

52 VB.NET DataGridView binding - Sql Server: One very common use of the DataGridView control is binding to a table in a database. The following vb.net program shows how to bind a SQL Server dataset in a DataGridView. Program 7: DataGridView example 1 Imports System.Data.OleDb Public Class Form1 Dim cn As New OleDbConnection Dim ds As New DataSet() Dim da As OleDbDataAdapter Dim sql As String Private Sub DisplayResult_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisplayResult_Button.Click Try cn.connectionstring = "PROVIDER=SQLOLEDB;server=.\SQLEXPRESS;database=sample;integrated security=sspi" cn.open() sql = "SELECT * FROM student1" da = New OleDbDataAdapter(sql, cn) da.fill(ds, "Std") cn.close() DataGridView1.DataSource = ds DataGridView1.DataMember = "Std" Catch ex As Exception

53 MsgBox(ex.Message) End Try Program 8: DataGridView example 2 Imports System.Data.OleDb Public Class Form1 Dim cn As New OleDbConnection Dim da As New OleDbDataAdapter Dim ds As New DataSet Dim sql As String Private Sub DisplayResult_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisplayResult_Button.Click Try cn.connectionstring = "PROVIDER=SQLOLEDB;server=.\SQLEXPRESS;database=sample;integrated security=sspi" cn.open() sql = "select * from student1" da.selectcommand = New OleDbCommand(sql, cn) da.fill(ds, "std") DataGridView1.DataSource = ds DataGridView1.DataMember = "std" Catch ex As Exception MsgBox(ex.Message) End Try Program 9: DataGridView example 3

54 Imports System.Data.OleDb Public Class Form1 Dim cn As New OleDbConnection Dim da As New OleDbDataAdapter Dim ds As New DataSet Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cn.connectionstring = "PROVIDER=SQLOLEDB;server=.\SQLEXPRESS;database=sample;integrated security=sspi" cn.open() Private Sub FullResult_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FullResult_Button.Click ds.clear() da.selectcommand = New OleDbCommand("select * from student1", cn) da.fill(ds, "std") DataGridView1.DataSource = ds DataGridView1.DataMember = "std" Private Sub RollNo_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RollNo_Button.Click ds.clear() da.selectcommand = New OleDbCommand("select * from student1 where rno = " & Val(TextBox1.Text), cn) da.fill(ds, "std") DataGridView1.DataSource = ds DataGridView1.DataMember = "std" Private Sub Name_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Name_Button.Click ds.clear() da.selectcommand = New OleDbCommand("select * from student1 where name like '" & TextBox1.Text & "%'", cn) da.fill(ds, "std") DataGridView1.DataSource = ds DataGridView1.DataMember = "std" Bind the following Control: Button Textbox Listbox For binding of textbox and button see example on next page.

55 Program 10: Program for Listbox binding. Imports System.Data.OleDb Public Class Form1 Dim cn As New OleDbConnection Dim ds As New DataSet Dim da As New OleDbDataAdapter Dim sql As String Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try cn.connectionstring = "provider=sqloledb;server=.\sqlexpress;database=sample;integrated security=sspi" cn.open() Catch ex As Exception MsgBox(ex.Message) End Try Private Sub DisplayNames_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DisplayNames_Button.Click sql = "select * from student1" da = New OleDbDataAdapter(sql, cn) da.fill(ds, "std") ListBox1.DataSource = ds.tables(0) ListBox1.DisplayMember = "name"

56 Program 11: Develop a Database Application Using Coding Method - Creating Connections - Data Binding - Navigation Among Records First Last Previous Next Imports System.Data.OleDb Public Class Form1 Dim cn As New OleDbConnection Dim da As New OleDbDataAdapter Dim ds As New DataSet Dim sql As String Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try cn.connectionstring = "provider=sqloledb;server=.\sqlexpress;database=sample;integrated security=sspi" cn.open() sql = "select * from student1" da = New OleDbDataAdapter(sql, cn) da.fill(ds, "std") TextBox1.DataBindings.Add("text", ds.tables(0), "rno") TextBox2.DataBindings.Add("text", ds.tables(0), "name") TextBox3.DataBindings.Add("text", ds.tables(0), "marks") cn.close() Catch ex As Exception

57 MsgBox(ex.Message) End Try Private Sub First_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles First_Button.Click Me.BindingContext(ds.Tables(0)).Position = 0 Private Sub Next_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Next_Button.Click Me.BindingContext(ds.Tables(0)).Position += 1 Private Sub Previous_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Previous_Button.Click Me.BindingContext(ds.Tables(0)).Position -= 1 Private Sub Last_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Last_Button.Click Me.BindingContext(ds.Tables(0)).Position = Me.BindingContext(ds.Tables(0)).Count Program 12: Perform Data Manipulation Using Ado.net Coding Methods - Add New Records - Delete Records - Update Records

58 Imports System.Data.OleDb Public Class Form1 Dim cn As New OleDbConnection Dim da As New OleDbDataAdapter Dim ds As New DataSet Dim sql As String Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Try cn.connectionstring = "provider=sqloledb;server=.\sqlexpress;database=sample;integrated security=sspi" cn.open() sql = "select * from student1" da = New OleDbDataAdapter(sql, cn) da.fill(ds, "std") TextBox1.DataBindings.Add("text", ds.tables(0), "rno") TextBox2.DataBindings.Add("text", ds.tables(0), "name") TextBox3.DataBindings.Add("text", ds.tables(0), "marks") Catch ex As Exception MsgBox(ex.Message) End Try cn.close() Private Sub First_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles First_Button.Click Me.BindingContext(ds.Tables(0)).Position = 0 Private Sub Previous_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Previous_Button.Click Me.BindingContext(ds.Tables(0)).Position -= 1

59 Private Sub Next_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Next_Button.Click Me.BindingContext(ds.Tables(0)).Position += 1 Private Sub Last_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Last_Button.Click Me.BindingContext(ds.Tables(0)).Position = Me.BindingContext(ds.Tables(0)).Count Private Sub Insert_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Insert_Button.Click Try cn.open() da.insertcommand = New OleDbCommand da.insertcommand.connection = cn da.insertcommand.commandtext = "insert into student1 values(" & Val(TextBox1.Text) & ",'" & TextBox2.Text & "'," & Val(TextBox3.Text) & ")" da.insertcommand.executenonquery() MsgBox("record inserted") ds.clear() da.fill(ds, "std") cn.close() Catch ex As Exception MsgBox(ex.Message) End Try Private Sub Update_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Update_Button.Click Try cn.open() da.updatecommand = New OleDbCommand da.updatecommand.connection = cn da.updatecommand.commandtext = "update student1 set name ='" & TextBox2.Text & "', marks = " & Val(TextBox3.Text) & " where rno = " & Val(TextBox1.Text) da.updatecommand.executenonquery() MsgBox("record updated") ds.clear() da.fill(ds, "std") cn.close() Catch ex As Exception MsgBox(ex.Message) End Try Private Sub Delete_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Delete_Button.Click Try cn.open() da.deletecommand = New OleDbCommand da.deletecommand.connection = cn da.deletecommand.commandtext = " delete from student1 where rno = " & TextBox1.Text

60 da.deletecommand.executenonquery() MsgBox("record deleted") ds.clear() da.fill(ds, "std") cn.close() Catch ex As Exception MsgBox(ex.Message) End Try Private Sub Clear_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clear_Button.Click TextBox1.Clear() TextBox2.Clear() TextBox3.Clear() Crystal Reports: Crystal Report is an application which can generate various reports from different data sources, we can create reports, print and preview those report using it, It is compatible with developing platforms and databases, In this example we will generate reports from VB.NET with Crystal Report. We will use sample database and student1 table which we have been using in the previous programs. Open Visual Studio.NET and select a new Visual Basic.NET Project.

61 Create a new Crystal Report for student1 table from the above database sample. From the main menu in Visual Studio select PROJECT-->Add New Item. Then Add New Item dialogue will appear and select Crystal Reports from the dialogue box.

62 Accept the default settings and click OK. Next step is to select the appropriate connection to your database. Here we are going to select OLEDB connection for SQL Server Select OLE DB (ADO) from Create New Connection.

63 Select Microsoft OLE DB Provider for SQL Server.

64 Next screen is the SQL Server authentication screen. Select your Sql Server name, enter userid, password or select integrated security and select your Database Name.

65 Click next, Then the screen shows OLE DB Property values, leave it as it is, and click finish. Then you will get your Server name under OLEDB Connection from there select database name (sample) and click the tables, then you can see all your tables from your database. From the tables list select student1 table to the right side list.

66 Click Next Button Select all fields from student1 table to the right side list.

67 Click Finish Button. Then you can see the Crystal Reports designer window. You can arrange the design according your requirements. Your screen looks like the following picture. Now the designing part is over and the next step is to call the created Crystal Reports in VB.NET through Crystal Reports Viewer control.

68 Select the default form (Form1.vb) you created in VB.NET and drag a button and CrystalReportViewer control to your form. Select Form's source code view and put the code on top Imports CrystalDecisions.CrystalReports.Engine Put the following source code in the button click event Dim cryrpt As New CrystalReport1 cryrpt.load("c:\users\mine\documents\visual Studio 2008\Projects\TextboxDataBinding\TextboxDataBinding\CrystalReport1.rpt" CrystalReportViewer1.ReportSource = cryrpt CrystalReportViewer1.Refresh() When display button is clicked it will generate report as shown in the figure given below.

69

DO NOT COPY AMIT PHOTOSTUDIO

DO NOT COPY AMIT PHOTOSTUDIO AMIT PHOTOSTUDIO These codes are provided ONLY for reference / Help developers. And also SUBMITTED IN PARTIAL FULFILLMENT OF THE REQUERMENT FOR THE AWARD OF BACHELOR OF COMPUTER APPLICATION (BCA) All rights

More information

Mr.Khaled Anwar ( )

Mr.Khaled Anwar ( ) The Rnd() function generates random numbers. Every time Rnd() is executed, it returns a different random fraction (greater than or equal to 0 and less than 1). If you end execution and run the program

More information

FOR 240 Homework Assignment 4 Using DBGridView and Other VB Controls to Manipulate Database Introduction to Computing in Natural Resources

FOR 240 Homework Assignment 4 Using DBGridView and Other VB Controls to Manipulate Database Introduction to Computing in Natural Resources FOR 240 Homework Assignment 4 Using DBGridView and Other VB Controls to Manipulate Database Introduction to Computing in Natural Resources This application demonstrates how a DataGridView control can be

More information

Creating databases using SQL Server Management Studio Express

Creating databases using SQL Server Management Studio Express Creating databases using SQL Server Management Studio Express With the release of SQL Server 2005 Express Edition, TI students and professionals began to have an efficient, professional and cheap solution

More information

This note is developed from the contents available in Fundamental to IS. Lab notes and exercises

This note is developed from the contents available in  Fundamental to IS. Lab notes and exercises Content: This note is developed from the contents available in www.homeandlearn.co.uk Fundamental to IS. Lab notes and exercises Introduction to VB.net and Databases Getting Started VB.net Forms Adding

More information

A Complete Tutorial for Beginners LIEW VOON KIONG

A Complete Tutorial for Beginners LIEW VOON KIONG I A Complete Tutorial for Beginners LIEW VOON KIONG Disclaimer II Visual Basic 2008 Made Easy- A complete tutorial for beginners is an independent publication and is not affiliated with, nor has it been

More information

ADO.NET 2.0. database programming with

ADO.NET 2.0. database programming with TRAINING & REFERENCE murach s ADO.NET 2.0 database programming with (Chapter 3) VB 2005 Thanks for downloading this chapter from Murach s ADO.NET 2.0 Database Programming with VB 2005. We hope it will

More information

Create a Windows Application that Reads- Writes PI Data via PI OLEDB. Page 1

Create a Windows Application that Reads- Writes PI Data via PI OLEDB. Page 1 Create a Windows Application that Reads- Writes PI Data via PI OLEDB Page 1 1.1 Create a Windows Application that Reads-Writes PI Data via PI OLEDB 1.1.1 Description The goal of this lab is to learn how

More information

Else. End If End Sub End Class. PDF created with pdffactory trial version

Else. End If End Sub End Class. PDF created with pdffactory trial version Dim a, b, r, m As Single Randomize() a = Fix(Rnd() * 13) b = Fix(Rnd() * 13) Label1.Text = a Label3.Text = b TextBox1.Clear() TextBox1.Focus() Private Sub Button2_Click(ByVal sender As System.Object, ByVal

More information

Form Adapter Example. DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date :

Form Adapter Example. DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date : Form Adapter Example DRAFT Document ID : Form_Adapter.PDF Author : Michele Harris Version : 1.1 Date : 2009-06-19 Form_Adapter.doc DRAFT page 1 Table of Contents Creating Form_Adapter.vb... 2 Adding the

More information

DRAWING AND MOVING IMAGES

DRAWING AND MOVING IMAGES DRAWING AND MOVING IMAGES Moving images and shapes in a Visual Basic application simply requires the user of a Timer that changes the x- and y-positions every time the Timer ticks. In our first example,

More information

"!#... )*! "!# )+, -./ 01 $

!#... )*! !# )+, -./ 01 $ Email engauday@hotmail.com! "!#... $ %&'... )*! "!# )+, -./ 01 $ ) 1+ 2#3./ 01 %.. 7# 89 ; )! 5/< 3! = ;, >! 5 6/.?

More information

How to use data sources with databases (part 1)

How to use data sources with databases (part 1) Chapter 14 How to use data sources with databases (part 1) 423 14 How to use data sources with databases (part 1) Visual Studio 2005 makes it easier than ever to generate Windows forms that work with data

More information

VB.NET Programs. ADO.NET (insert, update, view records)

VB.NET Programs. ADO.NET (insert, update, view records) ADO.NET (insert, update, view records) VB.NET Programs Database: Student Table : Studtab (adno, name, age, place) Controls: DataGridView, Insert button, View button, Update button, TextBox1 (for Admission

More information

Volume CREATIVE DATA TECHNOLOGIES, INC. DATALAYER.NET. Getting Started Guide

Volume CREATIVE DATA TECHNOLOGIES, INC. DATALAYER.NET. Getting Started Guide Volume 1 CREATIVE DATA TECHNOLOGIES, INC. DATALAYER.NET Getting Started Guide TABLE OF CONTENTS Table of Contents Table of Contents... 1 Chapter 1 - Installation... 2 1.1 Installation Steps... 2 1.1 Creating

More information

Revision for Final Examination (Second Semester) Grade 9

Revision for Final Examination (Second Semester) Grade 9 Revision for Final Examination (Second Semester) Grade 9 Name: Date: Part 1: Answer the questions given below based on your knowledge about Visual Basic 2008: Question 1 What is the benefit of using Visual

More information

Unit 3. Lesson Designing User Interface-2. TreeView Control. TreeView Contol

Unit 3. Lesson Designing User Interface-2. TreeView Control. TreeView Contol Designing User Interface-2 Unit 3 Designing User Interface-2 Lesson 3.1-3 TreeView Control A TreeView control is designed to present a list in a hierarchical structure. It is similar to a directory listing.

More information

LAMPIRAN. Universitas Sumatera Utara

LAMPIRAN. Universitas Sumatera Utara LAMPIRAN 1. Modul Imports System.Data Imports System.Data.OleDb Module Module1 Public conn As OleDbConnection Public CMD As OleDbCommand Public DS As New DataSet Public DA As OleDbDataAdapter Public RD

More information

Disclaimer. Trademarks. Liability

Disclaimer. Trademarks. Liability Disclaimer II Visual Basic 2010 Made Easy- A complete tutorial for beginners is an independent publication and is not affiliated with, nor has it been authorized, sponsored, or otherwise approved by Microsoft

More information

Building Datacentric Applications

Building Datacentric Applications Chapter 4 Building Datacentric Applications In this chapter: Application: Table Adapters and the BindingSource Class Application: Smart Tags for Data. Application: Parameterized Queries Application: Object

More information

Connection Example. Document ID : Connection_Example.PDF Author : Michele Harris Version : 1.1 Date :

Connection Example. Document ID : Connection_Example.PDF Author : Michele Harris Version : 1.1 Date : Connection Example Document ID : Connection_Example.PDF Author : Michele Harris Version : 1.1 Date : 2009-06-19 page 1 Table of Contents Connection Example... 2 Adding the Code... 2 Quick Watch myconnection...

More information

C# winforms gridview

C# winforms gridview C# winforms gridview using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;

More information

How to work with data sources and datasets

How to work with data sources and datasets Chapter 14 How to work with data sources and datasets Objectives Applied Use a data source to get the data that an application requires. Use a DataGridView control to present the data that s retrieved

More information

C16 Visual Basic Net Programming

C16 Visual Basic Net Programming C16 Visual Basic Net Programming Student ID Student Name Date - Module Tutor - 1 P a g e Report Contents Introduction... 2 Software Development Process... 3 Self Reflection... 6 References... 6 Appendices...

More information

M. K. Institute Of Computer Studies, Bharuch SYBCA SEM IV VB.NET (Question Bank)

M. K. Institute Of Computer Studies, Bharuch SYBCA SEM IV VB.NET (Question Bank) Unit-1 (overview of Microsoft.net framework) 1. What is CLR? What is its use? (2 times) 2 2. What is garbage collection? 2 3. Explain MSIL 2 4. Explain CTS in detail 2 5. List the extension of files available

More information

Visual Programming 1. What is Visual Basic? 2. What are different Editions available in VB? 3. List the various features of VB

Visual Programming 1. What is Visual Basic? 2. What are different Editions available in VB? 3. List the various features of VB Visual Programming 1. What is Visual Basic? Visual Basic is a powerful application development toolkit developed by John Kemeny and Thomas Kurtz. It is a Microsoft Windows Programming language. Visual

More information

Lesson 6: Using XML Queries

Lesson 6: Using XML Queries Lesson 6: Using XML Queries In the previous lesson you learned how to issue commands and how to retrieve the results of selections using the UniSelectList class, whether for regular enquiry statements

More information

Philadelphia University Faculty of Information Technology. Visual Programming. Using C# -Work Sheets-

Philadelphia University Faculty of Information Technology. Visual Programming. Using C# -Work Sheets- Philadelphia University Faculty of Information Technology Visual Programming Using C# -Work Sheets- Prepared by: Dareen Hamoudeh Eman Al Naji 2018 Work Sheet 1 Hello World! 1. Create a New Project, Name

More information

In this tutorial we will create a simple calculator to Add/Subtract/Multiply and Divide two numbers and show a simple message box result.

In this tutorial we will create a simple calculator to Add/Subtract/Multiply and Divide two numbers and show a simple message box result. Simple Calculator In this tutorial we will create a simple calculator to Add/Subtract/Multiply and Divide two numbers and show a simple message box result. Let s get started First create a new Visual Basic

More information

Data Access Standards. ODBC, OLE DB, and ADO Introduction. History of ODBC. History of ODBC 4/24/2016

Data Access Standards. ODBC, OLE DB, and ADO Introduction. History of ODBC. History of ODBC 4/24/2016 Data Access Standards ODBC, OLE DB, and ADO Introduction I Gede Made Karma The reasons for ODBC, OLE DB, and ADO are to provide a standardized method and API for accessing and manipulating Data from different

More information

Unit 4 Advanced Features of VB.Net

Unit 4 Advanced Features of VB.Net Dialog Boxes There are many built-in dialog boxes to be used in Windows forms for various tasks like opening and saving files, printing a page, providing choices for colors, fonts, page setup, etc., to

More information

HOUR 4 Understanding Events

HOUR 4 Understanding Events HOUR 4 Understanding Events It s fairly easy to produce an attractive interface for an application using Visual Basic.NET s integrated design tools. You can create beautiful forms that have buttons to

More information

(0,0) (600, 400) CS109. PictureBox and Timer Controls

(0,0) (600, 400) CS109. PictureBox and Timer Controls CS109 PictureBox and Timer Controls Let s take a little diversion and discuss how to draw some simple graphics. Graphics are not covered in the book, so you ll have to use these notes (or the built-in

More information

Windows Database Applications

Windows Database Applications 3-1 Windows Database Applications Chapter 3 In this chapter, you learn to access and display database data on a Windows form. You will follow good OOP principles and perform the database access in a datatier

More information

Learning VB.Net. Tutorial 17 Classes

Learning VB.Net. Tutorial 17 Classes Learning VB.Net Tutorial 17 Classes Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you enjoy it. If

More information

To enter the number in decimals Label 1 To show total. Text:...

To enter the number in decimals Label 1 To show total. Text:... Visual Basic tutorial - currency converter We will use visual studio to create a currency converter where we can convert a UK currency pound to other currencies. This is the interface for the application.

More information

Learning VB.Net. Tutorial 19 Classes and Inheritance

Learning VB.Net. Tutorial 19 Classes and Inheritance Learning VB.Net Tutorial 19 Classes and Inheritance Hello everyone welcome to vb.net tutorials. These are going to be very basic tutorials about using the language to create simple applications, hope you

More information

Microsoft Visual C# 2005: Developing Applications Table of Contents

Microsoft Visual C# 2005: Developing Applications Table of Contents Table of Contents INTRODUCTION...INTRO-1 Prerequisites...INTRO-2 Installing the Practice Files...INTRO-3 Software Requirements...INTRO-3 Sample Database...INTRO-3 Security...INTRO-4 Installation...INTRO-4

More information

SQL Server. Management Studio. Chapter 3. In This Chapter. Management Studio. c Introduction to SQL Server

SQL Server. Management Studio. Chapter 3. In This Chapter. Management Studio. c Introduction to SQL Server Chapter 3 SQL Server Management Studio In This Chapter c Introduction to SQL Server Management Studio c Using SQL Server Management Studio with the Database Engine c Authoring Activities Using SQL Server

More information

UNIT V - ADO.NET Database Programming with ADO.NET- Data Presentation Using the DataGridView Control- DataGridView- Updating the Original Database.

UNIT V - ADO.NET Database Programming with ADO.NET- Data Presentation Using the DataGridView Control- DataGridView- Updating the Original Database. Semester Course Code Course Title L P C IV UCS15402 Visual Basic.NET 3 2 0 UNIT I - VISUAL BASIC.NET and FRAME WORK The Common Type System- The Common Language Specification- The Common Language Runtime

More information

Visual C# Program: Simple Game 3

Visual C# Program: Simple Game 3 C h a p t e r 6C Visual C# Program: Simple Game 3 In this chapter, you will learn how to use the following Visual C# Application functions to World Class standards: Opening Visual C# Editor Beginning a

More information

GUI Design and Event- Driven Programming

GUI Design and Event- Driven Programming 4349Book.fm Page 1 Friday, December 16, 2005 1:33 AM Part 1 GUI Design and Event- Driven Programming This Section: Chapter 1: Getting Started with Visual Basic 2005 Chapter 2: Visual Basic: The Language

More information

Upgrading Applications

Upgrading Applications C0561587x.fm Page 77 Thursday, November 15, 2001 2:37 PM Part II Upgrading Applications 5 Your First Upgrade 79 6 Common Tasks in Visual Basic.NET 101 7 Upgrading Wizard Ins and Outs 117 8 Errors, Warnings,

More information

Visual Basic.NET. 1. Which language is not a true object-oriented programming language?

Visual Basic.NET. 1. Which language is not a true object-oriented programming language? Visual Basic.NET Objective Type Questions 1. Which language is not a true object-oriented programming language? a.) VB.NET b.) VB 6 c.) C++ d.) Java Answer: b 2. A GUI: a.) uses buttons, menus, and icons.

More information

Form Connection. Imports System Imports System.Threading Imports System.IO.Ports Imports System.ComponentModel

Form Connection. Imports System Imports System.Threading Imports System.IO.Ports Imports System.ComponentModel Form Connection Imports System Imports System.Threading Imports System.IO.Ports Imports System.ComponentModel Public Class connection '------------------------------------------------ Dim myport As Array

More information

Objectives. After completing this topic, the students will: Understand of the concept of polymorphism Know on How to implement 2 types of polymorphism

Objectives. After completing this topic, the students will: Understand of the concept of polymorphism Know on How to implement 2 types of polymorphism Polymorphism Objectives After completing this topic, the students will: Understand of the concept of polymorphism Know on How to implement 2 types of polymorphism Definition Polymorphism provides the ability

More information

Design Of Human Computer Interfaces Assignment 1- Hello World. Compliance Report

Design Of Human Computer Interfaces Assignment 1- Hello World. Compliance Report Design Of Human Computer Interfaces Assignment 1- Hello World Compliance Report Prepared for: Skip Poehlman Prepared By: K C Course: SE 4D03 Date: September 30, 2008 Contents 1. Code Listing a. Module

More information

PLATFORM TECHNOLOGY UNIT-4

PLATFORM TECHNOLOGY UNIT-4 VB.NET: Handling Exceptions Delegates and Events - Accessing Data ADO.NET Object Model-.NET Data Providers Direct Access to Data Accessing Data with Datasets. ADO.NET Object Model ADO.NET object model

More information

About the Authors Introduction p. 1 Exploring Application Architectures p. 9 Introduction p. 9 Choosing the "Right" Architecture p.

About the Authors Introduction p. 1 Exploring Application Architectures p. 9 Introduction p. 9 Choosing the Right Architecture p. Foreword p. xxi Acknowledgments p. xxiii About the Authors p. xxv Introduction p. 1 Exploring Application Architectures p. 9 Introduction p. 9 Choosing the "Right" Architecture p. 10 Understanding Your

More information

END-TERM EXAMINATION

END-TERM EXAMINATION (Please Write your Exam Roll No. immediately) END-TERM EXAMINATION DECEMBER 2006 Exam. Roll No... Exam Series code: 100274DEC06200274 Paper Code : MCA-207 Subject: Front End Design Tools Time: 3 Hours

More information

MenuStrip Control. The MenuStrip control represents the container for the menu structure.

MenuStrip Control. The MenuStrip control represents the container for the menu structure. MenuStrip Control The MenuStrip control represents the container for the menu structure. The MenuStrip control works as the top-level container for the menu structure. The ToolStripMenuItem class and the

More information

VB.NET. Exercise 1: Creating Your First Application in Visual Basic.NET

VB.NET. Exercise 1: Creating Your First Application in Visual Basic.NET VB.NET Module 1: Getting Started This module introduces Visual Basic.NET and explains how it fits into the.net platform. It explains how to use the programming tools in Microsoft Visual Studio.NET and

More information

Module 8: Building a Windows Forms User Interface

Module 8: Building a Windows Forms User Interface Module 8: Building a Windows Forms User Interface Table of Contents Module Overview 8-1 Lesson 1: Managing Forms and Dialog Boxes 8-2 Lesson 2: Creating Menus and Toolbars 8-13 Lab: Implementing Menus

More information

M. K. Institute Of Computer Studies, Bharuch SYBCA SEM IV VB.NET (Question Bank)

M. K. Institute Of Computer Studies, Bharuch SYBCA SEM IV VB.NET (Question Bank) Unit-1 (overview of Microsoft.net framework) 1. What is CLR? What is its use? (2 times) 2 2. What is garbage collection? 2 3. Explain MSIL (mar/apr-201) 2 times 2 4. Explain CTS in detail 2 5. List the

More information

Running the Altair SIMH from.net programs

Running the Altair SIMH from.net programs Running the Altair SIMH from.net programs The Altair SIMH simulator can emulate a wide range of computers and one of its very useful features is that it can emulate a machine running 50 to 100 times faster

More information

Interacting with External Applications

Interacting with External Applications Interacting with External Applications DLLs - dynamic linked libraries: Libraries of compiled procedures/functions that applications link to at run time DLL can be updated independently of apps using them

More information

Building Windows Front Ends to SAS Software. Katie Essam Amadeus Software Limited 20 th May 2003

Building Windows Front Ends to SAS Software. Katie Essam Amadeus Software Limited 20 th May 2003 Building Windows Front Ends to SAS Software Katie Essam Amadeus Software Limited 20 th May 2003 Topics Introduction What is.net? SAS Software s Interoperability Communicating with SAS from VB.NET Conclusions

More information

Programming with Microsoft Visual Basic.NET. Array. What have we learnt in last lesson? What is Array?

Programming with Microsoft Visual Basic.NET. Array. What have we learnt in last lesson? What is Array? What have we learnt in last lesson? Programming with Microsoft Visual Basic.NET Using Toolbar in Windows Form. Using Tab Control to separate information into different tab page Storage hierarchy information

More information

Mainly three tables namely Teacher, Student and Class for small database of a school. are used. The snapshots of all three tables are shown below.

Mainly three tables namely Teacher, Student and Class for small database of a school. are used. The snapshots of all three tables are shown below. APPENDIX 1 TABLE DETAILS Mainly three tables namely Teacher, Student and Class for small database of a school are used. The snapshots of all three tables are shown below. Details of Class table are shown

More information

MapWindow Plug-in Development

MapWindow Plug-in Development MapWindow Plug-in Development Sample Project: Simple Path Analyzer Plug-in A step-by-step guide to creating a custom MapWindow Plug-in using the IPlugin interface by Allen Anselmo shade@turbonet.com Introduction

More information

Hands-On Lab. Introduction to SQL Azure. Lab version: Last updated: 12/15/2010

Hands-On Lab. Introduction to SQL Azure. Lab version: Last updated: 12/15/2010 Hands-On Lab Introduction to SQL Azure Lab version: 2.0.0 Last updated: 12/15/2010 Contents OVERVIEW... 3 EXERCISE 1: PREPARING YOUR SQL AZURE ACCOUNT... 5 Task 1 Retrieving your SQL Azure Server Name...

More information

Getting Started with Visual Basic.NET

Getting Started with Visual Basic.NET Visual Basic.NET Programming for Beginners This Home and Learn computer course is an introduction to Visual Basic.NET programming for beginners. This course assumes that you have no programming experience

More information

IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants

IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants IMS1906: Business Software Fundamentals Tutorial exercises Week 5: Variables and Constants These notes are available on the IMS1906 Web site http://www.sims.monash.edu.au Tutorial Sheet 4/Week 5 Please

More information

Data Source. Application. Memory

Data Source. Application. Memory Lecture #14 Introduction Connecting to Database The term OLE DB refers to a set of Component Object Model (COM) interfaces that provide applications with uniform access to data stored in diverse information

More information

2017/ st Sec Final revision Final revision

2017/ st Sec Final revision Final revision Q1)Put ( ) or (x): 1. We open channel of communication between the programme that is created in Visual basic Dot Net language and Excel file by using ADO.NET tools. ( ) 2. Variable of type ( OleDbConnection)

More information

You can call the project anything you like I will be calling this one project slide show.

You can call the project anything you like I will be calling this one project slide show. C# Tutorial Load all images from a folder Slide Show In this tutorial we will see how to create a C# slide show where you load everything from a single folder and view them through a timer. This exercise

More information

Visual Basic 2008 Anne Boehm

Visual Basic 2008 Anne Boehm TRAINING & REFERENCE murach s Visual Basic 2008 Anne Boehm (Chapter 3) Thanks for downloading this chapter from Murach s Visual Basic 2008. We hope it will show you how easy it is to learn from any Murach

More information

MATFOR In Visual Basic

MATFOR In Visual Basic Quick Start t t MATFOR In Visual Basic ANCAD INCORPORATED TEL: +886(2) 8923-5411 FAX: +886(2) 2928-9364 support@ancad.com www.ancad.com 2 MATFOR QUICK START Information in this instruction manual is subject

More information

C# Programming: From Problem Analysis to Program Design 2nd Edition. David McDonald, Ph.D. Director of Emerging Technologies. Objectives (1 of 2)

C# Programming: From Problem Analysis to Program Design 2nd Edition. David McDonald, Ph.D. Director of Emerging Technologies. Objectives (1 of 2) 13 Database Using Access ADO.NET C# Programming: From Problem Analysis to Program Design 2nd Edition David McDonald, Ph.D. Director of Emerging Technologies Objectives (1 of 2) Retrieve and display data

More information

C4.3, 4 Lab: Conditionals - Select Statement and Additional Input Controls Solutions

C4.3, 4 Lab: Conditionals - Select Statement and Additional Input Controls Solutions C4.3, 4 Lab: Conditionals - Select Statement and Additional Input Controls Solutions Between the comments included with the code and the code itself, you shouldn t have any problems understanding what

More information

Darshan Institute of Engineering & Technology for Diploma Studies

Darshan Institute of Engineering & Technology for Diploma Studies Dialog Box: There are many built-in dialog boxes to be used in Windows forms for various tasks like opening and saving files, printing a page, providing choices for colors, fonts, page setup, etc., to

More information

6 Months Training Module in.net Module 1-Total Days-20

6 Months Training Module in.net Module 1-Total Days-20 6 Months Training Module in.net Visual Studio Version: 2008.net Framework: 3.5 Database: SQL Server 2005 Module 1-Total Days-20 Introduction to.net framework: History of.net.net framework.net version Features/advantages

More information

Unit 3 Additional controls and Menus of Windows

Unit 3 Additional controls and Menus of Windows Working with other controls of toolbox: DateTime Picker If you want to enable users to select a date and time, and to display that date and time in the specified format, use the DateTimePicker control.

More information

.NET and DB2 united with IBM DB2.NET Data Provider Objectives :.NET ADO.NET DB2 and ADO.NET DB2 - ADO.NET applications

.NET and DB2 united with IBM DB2.NET Data Provider Objectives :.NET ADO.NET DB2 and ADO.NET DB2 - ADO.NET applications .NET and DB2 united with IBM DB2.NET Data Provider Objectives :.NET ADO.NET DB2 and ADO.NET DB2 - ADO.NET applications ABIS Training & Consulting 1 DEMO Win Forms client application queries DB2 according

More information

Introduction. Three button technique. "Dynamic Data Grouping" using MS Reporting Services Asif Sayed

Introduction. Three button technique. Dynamic Data Grouping using MS Reporting Services Asif Sayed Image: 1.0 Introduction We hear this all the time, Two birds with one stone. What if I say, Four birds with one stone? I am sure four sound much better then two. So, what are my four birds and one stone?

More information

User's Guide c-treeace SQL Explorer

User's Guide c-treeace SQL Explorer User's Guide c-treeace SQL Explorer Contents 1. c-treeace SQL Explorer... 4 1.1 Database Operations... 5 Add Existing Database... 6 Change Database... 7 Create User... 7 New Database... 8 Refresh... 8

More information

The Filter Property Selecting a File The Save Menu The SaveFileDialog Control The Edit Menu The Copy Menu...

The Filter Property Selecting a File The Save Menu The SaveFileDialog Control The Edit Menu The Copy Menu... Part One Contents Introduction...3 What you need to do the course...3 The Free Visual Basic Express Edition...3 Additional Files...4 Getting Started...5 The Toolbox...9 Properties...15 Saving your work...21

More information

Instructor: Craig Duckett. Lecture 14: Tuesday, May 15 th, 2018 Stored Procedures (SQL Server) and MySQL

Instructor: Craig Duckett. Lecture 14: Tuesday, May 15 th, 2018 Stored Procedures (SQL Server) and MySQL Instructor: Craig Duckett Lecture 14: Tuesday, May 15 th, 2018 Stored Procedures (SQL Server) and MySQL 1 Assignment 3 is due LECTURE 20, Tuesday, June 5 th Database Presentation is due LECTURE 20, Tuesday,

More information

COPYRIGHTED MATERIAL. Visual Basic: The Language. Part 1

COPYRIGHTED MATERIAL. Visual Basic: The Language. Part 1 Part 1 Visual Basic: The Language Chapter 1: Getting Started with Visual Basic 2010 Chapter 2: Handling Data Chapter 3: Visual Basic Programming Essentials COPYRIGHTED MATERIAL Chapter 1 Getting Started

More information

Tutorial 5 Database. Adam Sek Keb Wira 12 A123 6 Amanah Tmn Mahkota

Tutorial 5 Database. Adam Sek Keb Wira 12 A123 6 Amanah Tmn Mahkota Task 1 Creating a database using Access 2010: Tutorial 5 Database 1. Using Microsoft Access create a database for; a. Name b. School c. Age d. Birth Cert No e. Year f. Address g. Date of birth 2. Type

More information

BE Share. Microsoft Office SharePoint Server 2010 Basic Training Guide

BE Share. Microsoft Office SharePoint Server 2010 Basic Training Guide BE Share Microsoft Office SharePoint Server 2010 Basic Training Guide Site Contributor Table of Contents Table of Contents Connecting From Home... 2 Introduction to BE Share Sites... 3 Navigating SharePoint

More information

Microsoft Visual Basic 2005 CHAPTER 6. Loop Structures

Microsoft Visual Basic 2005 CHAPTER 6. Loop Structures Microsoft Visual Basic 2005 CHAPTER 6 Loop Structures Objectives Add a MenuStrip object Use the InputBox function Display data using the ListBox object Understand the use of counters and accumulators Understand

More information

Introduction. Getting Started with Visual Basic Steps:-

Introduction. Getting Started with Visual Basic Steps:- Introduction Getting Started with Visual Basic 2008 Steps:- 1. go to http://www.microsoft.com/express/download/#webinstall and download Visual Basic 2008 and save the file in a location. 2. Locate the

More information

VB.NET Web : Phone : INTRODUCTION TO NET FRAME WORK

VB.NET Web : Phone : INTRODUCTION TO NET FRAME WORK Web :- Email :- info@aceit.in Phone :- +91 801 803 3055 VB.NET INTRODUCTION TO NET FRAME WORK Basic package for net frame work Structure and basic implementation Advantages Compare with other object oriented

More information

1. Create your First VB.Net Program Hello World

1. Create your First VB.Net Program Hello World 1. Create your First VB.Net Program Hello World 1. Open Microsoft Visual Studio and start a new project by select File New Project. 2. Select Windows Forms Application and name it as HelloWorld. Copyright

More information

Protegent Total Security Solution USER GUIDE Unistal Systems Pvt. Ltd. All rights Reserved Page 1

Protegent Total Security Solution USER GUIDE Unistal Systems Pvt. Ltd. All rights Reserved Page 1 Protegent Total Security Solution USER GUIDE 2007-2017 Unistal Systems Pvt. Ltd. All rights Reserved Page 1 Table of Contents PROTEGENT TOTAL SECURITY...3 INSTALLATION...4 REGISTERING PROTEGENT TOTAL SECURITY...

More information

Model Question Paper. Credits: 4 Marks: 140. Part A (One mark questions)

Model Question Paper. Credits: 4 Marks: 140. Part A (One mark questions) Model Question Paper Subject Code: MT0040 Subject Name: VB.Net Credits: 4 Marks: 140 (One mark questions) 1. The is a systematic class framework used for the development of system tools and utilities.

More information

C# Syllabus. MS.NET Framework Introduction

C# Syllabus. MS.NET Framework Introduction C# Syllabus MS.NET Framework Introduction The.NET Framework - an Overview Framework Components Framework Versions Types of Applications which can be developed using MS.NET MS.NET Base Class Library MS.NET

More information

Oracle Rdb Developer Tools for Visual Studio Developer's Guide Release June 2015

Oracle Rdb Developer Tools for Visual Studio Developer's Guide Release June 2015 Oracle Rdb Developer Tools for Visual Studio Developer's Guide Release 7.3.4.0 June 2015 Oracle Rdb Data Provider for.net Developer's Guide, Release 7.3.4.0 Copyright 2011, 2015 Oracle and/or its affiliates.

More information

Ingegneria del Software T. Interfaccia utente

Ingegneria del Software T. Interfaccia utente Interfaccia utente Creating Windows Applications Typical windows-application design & development 1+ classes derived from System.Windows.Forms.Form Design UI with VisualStudio.NET Possible to do anything

More information

Hands-On Lab. Introduction to SQL Azure. Lab version: Last updated: 11/16/2010

Hands-On Lab. Introduction to SQL Azure. Lab version: Last updated: 11/16/2010 Hands-On Lab Introduction to SQL Azure Lab version: 2.0.0 Last updated: 11/16/2010 Contents OVERVIEW... 3 EXERCISE 1: PREPARING YOUR SQL AZURE ACCOUNT... 6 Task 1 Retrieving your SQL Azure Server Name...

More information

WINDOWS NT BASICS

WINDOWS NT BASICS WINDOWS NT BASICS 9.30.99 Windows NT Basics ABOUT UNIVERSITY TECHNOLOGY TRAINING CENTER The University Technology Training Center (UTTC) provides computer training services with a focus on helping University

More information

If this is the first time you have run SSMS, I recommend setting up the startup options so that the environment is set up the way you want it.

If this is the first time you have run SSMS, I recommend setting up the startup options so that the environment is set up the way you want it. Page 1 of 5 Working with SQL Server Management Studio SQL Server Management Studio (SSMS) is the client tool you use to both develop T-SQL code and manage SQL Server. The purpose of this section is not

More information

CSC 330 Object-Oriented

CSC 330 Object-Oriented CSC 330 Object-Oriented Oriented Programming Using ADO.NET and C# CSC 330 Object-Oriented Design 1 Implementation CSC 330 Object-Oriented Design 2 Lecture Objectives Use database terminology correctly

More information

Programming Logic -Intermediate

Programming Logic -Intermediate Programming Logic -Intermediate 152-102 Database Access Text References Data Access Concepts No book references Diagram Connected vs. Disconnected Adding a Data Source View Data in Grid View Data in Fields

More information

S.2 Computer Literacy Question-Answer Book

S.2 Computer Literacy Question-Answer Book S.2 C.L. Half-yearly Examination (2012-13) 1 12-13 S.2 C.L. Question- Answer Book Hong Kong Taoist Association Tang Hin Memorial Secondary School 2012-2013 Half-yearly Examination S.2 Computer Literacy

More information

CALIFORNIA STATE UNIVERSITY, SACRAMENTO College of Business Administration. MIS 15 Introduction to Business Programming. Programming Assignment 3 (P3)

CALIFORNIA STATE UNIVERSITY, SACRAMENTO College of Business Administration. MIS 15 Introduction to Business Programming. Programming Assignment 3 (P3) CALIFORNIA STATE UNIVERSITY, SACRAMENTO College of Business Administration MIS 15 Introduction to Business Programming Programming Assignment 3 (P3) Points: 50 Due Date: Tuesday, May 10 The purpose of

More information

Menus, Common Dialog Controls, Context Menus, Sub Procedures, and Functions

Menus, Common Dialog Controls, Context Menus, Sub Procedures, and Functions 5-menus.htm; updated September 12, 2011 Menus, Common Dialog Controls, Context Menus, Sub Procedures, and Functions Coverage: This chapter covers several important topics: (1) use of menus and context

More information

Oracle Rdb Developer Tools for Visual Studio Developer s Guide, Release Copyright 2011 Oracle Corporation Corporation. All rights reserved.

Oracle Rdb Developer Tools for Visual Studio Developer s Guide, Release Copyright 2011 Oracle Corporation Corporation. All rights reserved. Oracle Rdb Developer Tools for Visual Studio Developer's Guide V7.3.2.1 May 2011 Oracle Rdb Developer Tools for Visual Studio Developer s Guide, Release 7.3-21 Copyright 2011 Oracle Corporation Corporation.

More information

Mahathma Gandhi University

Mahathma Gandhi University Mahathma Gandhi University BSc Computer science III Semester BCS 303 OBJECTIVE TYPE QUESTIONS Choose the correct or best alternative in the following: Q.1 In the relational modes, cardinality is termed

More information