2015 Marwa moutaz [Company name] 1/1/2015 Software engineering modeling lab lectures
This series of lectures was prepared for the third class of software engineering / Aliraqia University/ Baghdad/ Iraq. In prepared these lectures, I depend on the YouTube to make it, the programs of the lectures are designed and executed by vb.net, discussions are also found here These lectures are not finished yet, i will improve it in the future Forgive me for anything wrong by mistake, I wish you can profit from these lectures My regard Marwa Moutaz/ M.Sc. studies of Communication Engineering / University of Technology/ Bagdad / Iraq.
Introduction to Visual Basic. Net Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: One
INTRODUCTION In this lecture, we will study an introduction to visual basic.net. Learn how to: open the program, study the basic windows properties and made a simple program by it. PROCEDURE:- Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Visual Basic.Net Environments  Open the program Start/ programs/ Microsoft visual studio 2008/ Microsoft visual studio 2008 / see figure 1.1
Figure 1.1 open the program  To start creating your first application, you need to click on file and select new project. Or choose create as shown in figure 1.2 , a new window is appear as shown in figure 1.3
Figure 1.2 open a new project
Figure 1.3 open a new application window  The Visual Studio environment appears. Each window can be moved, resized, closed, or customized.as shown in figure 1.4
Figure 1.4 The Visual Studio environment  The Toolbars You can use the buttons on the toolbars as shortcuts for frequently used operations. Each button represents a command that also can be selected from a menu. Figure 1.5 shows the toolbar buttons on the Standard toolbar for the Professional Edition, which displays in the main window of the IDE.
Figure 1.5 the Toolbars Example: Design a program that contain one command button called “calculator”, when press this button, a message box appears and gives the sum of two numbers.  First of all, drag one common button into the form and change its default name to calculate.  Next, click on the calculate button and key in the following code at the source code window as shown below. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim num1, num2, sum As Single num1 = 100 num2 = 200
sum = num1 + num2 MsgBox(" The Sum of " & num1 & " and " & num2 & " is " & sum) End Sub  Now run your first application! And you can see the follow message box showing the sum of two numbers. Example: Design a program that contain one command button called “calculator” and two text box and 2 labels * & =, when press this button, it calculate the product of the two numbers that entered in the textboxes.
Textbox3.text= product End sub Discussion 1- What the steps of open visual basic.net & the steps are of write an application. 2- Design a program that contain one command button called “calculator” and 3 text box, when press this button, it calculate the sum of the three numbers that entered in the textboxes. 3- Design a program that contain one command button called “sum”, when press this button, a message box appears and gives the sum of four numbers.
Introduction to properties window & Create VB.NET applications Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: two
INTRODUCTION In this lecture, we will create programs in visual basic. Net, learn how to use labels, textbox, pictures and change their properties by using windows properties. PROCEDURE:- Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example: - HELLO WORD Design a program that contain one button named “click me’’, when click this button a message box appear showed “hello word” as shown in the figure below.
1- Open the program and design the form as given in figure above 2- Change the properties of the button as shown in the figure below (choose text and change the name of it to “click me “) 3- Writing the code  Double-click the button on the form. And write the following code 4- Run the program.
Example: Lucky Seven: Design a game program that simulates a lucky number slot machine. Lucky Seven has a simple user interface as shown in figure 2.1 (a) design (b) execution, when a number 7 appears in one of the labels , a picture will shows up. (a) (b) Figure 2.1 (a) design (b) execution 1-Open the program and design the form as given in fig (2.1a)
2-2Change the properties of the commands as shown in the table below Tools Property New property Button 1 Text spin Button 2 Text End Label 1 Text 0 Label 2 Text 0 Label 3 Text 0 Label 4 Text Lucky seven Picture box Image Size mode visible “c:vb08sbschap02paycoins.jpg” StretchImage False 3-Writing the code  Double-click the End button on the form. And write the following code Private Sub Button2_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button2.Click End End Sub  Double-click the spin button on the form. And write the following code Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click PictureBox1.Visible = False ' hide picture Label1.Text = CStr(Int(Rnd() * 10)) ' pick numbers Label2.Text = CStr(Int(Rnd() * 10)) Label3.Text = CStr(Int(Rnd() * 10)) ' if any number is 7 display picture and beep If (Label1.Text = "7") Or (Label2.Text = "7") _ Or (Label3.Text = "7") Then PictureBox1.Visible = True Beep() End If End Sub
 The code will be as shown at finished 4- Run the program. Notes about code:- You then need to jump through a little hoop in your code. You need to copy these random numbers into the three label boxes on the form, but fi rst the numbers need to be converted to text with the CStr (convert to string) function. Notice how CStr, Int, and Rnd are all connected together in the program statement—they work collectively to produce a result like a mathematical formula
Discussion 1- Design a program contain two buttons named (Ahmed, Ali), when click on the first button, a message box appear and showed “hello Ahmed”, and when click on the second button, a message box appear and showed “hello Ali”. 2- Design a program that calculate the following equation N= X + y + z + b / v * c Each of the input variables is entered during the execution of the program 3- How to change the properties of a specific button? Give 2 ways.
Working with tool box Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: three
INTRODUCTION In this lecture, we will create programs in visual basic. Net, learn how to use date time picker control and link label in simple programs. PROCEDURE:- Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example: - Birthday program Design a program that contain one button and one DateTimePicker control , when click this button a message box appear showed your birthday as shown in the figure below.
3- Open the program and design the form as given in figure above 4- Change the properties of the button (choose text and change the name of it to “show my birthday “) 3- Writing the code  Double-click the button on the form. And write the following code MsgBox("Your birth date was " & DateTimePicker1.Text) MsgBox("Day of the year: " & DateTimePicker1.Value.DayOfYear.ToString()) 5- Run the program. Note The statement DateTimePicker1.Value.DayOfYear.ToString() uses the date/time picker object to calculate the day of the year in which you were born, counting from January 1. This is accomplished by the DayOfYear property and the ToString method, which converts the numeric result of the date calculation to a textual value that’s more easily displayed by the MsgBox function. Example: Web link program: Design a program that contain one link label, when click this link label, it open web page as shown in figure below.
1- Open the program and design the form as given in figure above. 2-Change the properties of the linklabel as shown below:- Tools Property New property linklabel Text http://www.microsoft.com/learning/books/ 3-Writing the code  Double-click the linklabel on the form. And write the following code Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked ' Change the color of the link by setting LinkVisited to True. LinkLabel1.LinkVisited = True ' Use the Process.Start method to open the default browser ' using the Microsoft Press URL: System.Diagnostics.Process.Start _ ("http://www.microsoft.com/learning/books/") End Sub 4- Run the program.
Example: simple calculator program Design a simple calculator that contain one button called calculate and 3 text box and 4 radio button, as shown in figure below. 1- Open the program and design the form as given in figure above. 2-Change the properties of the tools as shown below:- Tools Property New property Button1 Text Calculate Radiobutton1 Text addition Radiobutton2 Text subtraction Radiobutton3 Text multiplication Radiobutton4 Text division 3-Writing the code  Double-click the calculate button on the form. And write the following code Private Sub button1_Click (ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
Dim a as integer Dim b as integer a= textbox1.text b= textbox2.text if radiobutton1.checked = true then textbox3.text= a+b elseif radiobutton2.checked = true then textbox3.text= a-b elseif radiobutton3.checked = true then textbox3.text= a*b elseif radiobutton4.checked = true then textbox3.text= a/b end if End Sub 4- Run the program. Discussion 4- Design a program contain four labels named (Facebook, mail, google, yahoo), and four linklabel dedicated to the names of the labels, when click on them, it opens a webpage dedicated to the names of the label. 5- Design a program that calculate the following equation N= 𝑋2 + 𝑦2 / 𝑣2 * 𝑐2 Each of the input variables is entered during the execution of the program
Working with Menus, Toolbars, and Dialog Boxes Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: four
INTRODUCTION After completing this lecture, you will be able to: � Add menus to your programs by using the MenuStrip control. �design a professional windows video player Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example: - Create a menu Design a program that contain a menu consist of two command (date & time) , one label , when click the command date, the date is appears in the label , and the same thing for the time as shown in the figure below.
6- Open the program and create a new project. 7- Click the MenuStrip control on the Menus & Toolbars tab of the Toolbox, and then draw a menu control on your form. 8- Click the Type Here tag, type Clock, and then press Enter. 9- Type Date to create a Date command for the Clock menu, and then press Enter. 10- Type Time to create a Time command for the menu, and then press Enter. Your form looks like the one shown here:
11- Add a label object to the form 12- Change the properties of the button as shown by the table below 8- Writing the code  Double-click the time command in the clock menu. And write the following code Private Sub TimeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimeToolStripMenuItem.Click Label1.Text = TimeString End sub  Double-click the date command in the clock menu. And write the following code Private Sub DateToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateToolStripMenuItem.Click Label1.Text = DateString End sub 9-Run the program. Note The TimeToolStripMenuItem_Click event procedure appears in the Code Editor. The name TimeToolStripMenuItem_Click includes the name Time that you gave this menu command. The words ToolStripMenuItem indicate that in its underlying technology, the MenuStrip control is related to the ToolStrip control. (We’ll see further examples of that later in this chapter.) The _Click syntax means that this is the event procedure that runs when a user clicks the menu item.
Example: Create a professional video and voice player Design a professional video and voice player program that contain one windows media player, a menu [open, play, pause , resume, stop, about, exit ]and one OpenFileDialoge as shown in the figure below. 1-Open the program and create a new project. 2-add a windows media player , follow the steps in the figures below
3- after chose windows media player from COM component , drag it to the form as shown below , and change the property of it ( dock ------choose fill)
4-add a menu strip to the form and an open file dialog, your figure should look like:-
5-Writing the code  Double-click the open menu. And write the following code  Double-click the play menu. And write the following code  Double-click the stop menu. And write the following code  Double-click the pause menu. And write the following code  Double-click the resume menu. And write the following code  Double-click the about menu. And write the following code
 Double-click the exit menu. And write the following code 6- Run the program. Discussion 1- Design a program that contain two button and two labels, when click the command show, the program shows a variable name “ last name” in the label 1 , and change the name variable “last name” to “Bodenstein von Karlstadt” and showes it in the label 2 at the same time as shown in the figure below. 2- Design a program that contain two button and one labels, when click the command “input box”, the program shows input box asked you to enter your name , when you enter your name and click ok , your name shows in the label as shown in the figure below.
Connect access data base to vb.net and create your program Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: four
INTRODUCTION After completing this lecture, you will be able to: Connect access data base to vb.net and create your first real program Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example: - connect access to vb.net Steps of work 1- Open the access and create a simple table as shown below
2- Save the program in documents and named it yousif 3- Open vb.net and open a new project 4- Choose “ add new data source” from project as shown below and follow the steps in the pictures
5- Select the table and click finish as shown in the figure below
If the data source doesn’t exsisit on the program at the upper corner , go to :- From view choose other windows and then select data source Show the detail of the table as shown below 6- Drag the table to the form , it will appear on the form as shown below
7- Now , we will make the program work even it doesn’t open by vb.net ,choose purplish windows application option from build menu , follow the pictures below Click brose and choose the location you want to save the program on it , choose desktop as shown below
Use vb.net tools and Create a calendar & run programs Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: six
INTRODUCTION After completing this lecture, you will be able to: You will be able to create a professional calendar program. Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example: - design a calendar program that contain a menu (file, edit, format, help) and a textbox, the contents of the menus are as shown in the figures below
The final figure of the program is as shown below 13- Open the program ,add menu strip and textbox, design the form as given in the figure above 2-Change the properties of the commands as shown in the table below Tools Property New property form Text ‫المفكرة‬ textbox multiline true textbox dock fill textbox maxlength 0 textbox scrollbar vertical textbox Font Font Font style size Arial Regular 18 3-Writing the code  Double-click the button new in the file menu. And write the following code
 Double-click the button open in the file menu. And write the following code  Double-click the button exit in the file menu. And write the following code  Double-click the button undo in the edit menu. And write the following code  Double-click the button select all in the edit menu. And write the following code
 Double-click the button paste in the edit menu. And write the following code  Double-click the button copy in the edit menu. And write the following code  Double-click the button cut in the edit menu. And write the following code  Double-click the button clear in the edit menu. And write the following code
 Double-click the button insert time and date in the edit menu. And write the following code  Double-click the button font in the format menu. And write the following code  Double-click the button text color in the format menu. And write the following code  Double-click the button back color in the format menu. And write the following code
 Double-click the button about in the help menu. And write the following code Messagebox.show (“calendar program”) 4-Run the program Write any sentence and try the choices from the calendar program Example: RUN program Design a RUN program that contain one textbox, 3 buttons, and one picture box, it uses to open any program safely, its work is similar to the run program of the computer, the final program is as shown in the figure below 1-Open the program and design the form as given in the fig above, add picture box and drag it to cover all the form as shown in the fig below , and then right click and choose send to back , the tools will show up again
2-Change the properties of the commands as shown in the table below Tools Property New property form 1 Text Run program Button 1 Text RUN Button 2 Text about Button 3 Text exit Picyurebox1 Image sizemode Choose image from computer stretch 3-Writing the code  Double-click the RUN button on the form. And write the following code  Double-click the about button on the form. And write the following code Msgbox (“RUN PROGRAM”) End Sub  Double-click the exit button on the form. And write the following code End Endsub
4- Run the program, write in the textbox sequentially (write, notepad)
Discussion 1- Design a program for a school to calculate students course1 average, course2 average , midterm average and the final state as shown in the figure below 2- Design an illusion chat program, when write in the textbox1 and click send, the respond of the second person appears in the textbox2 at the same time as shown in the figure bellow.
Use vb.net tools and Create a web browser & binary translator Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: seven
INTRODUCTION After completing this lecture, you will be able to: You will be able to create a professional web browser program and a binary translator. Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example: - design a web browser program that contain, 1 panel, 7 buttons, 2 textbox, 1 label, webbrowser, the final figure is as shown below Hint: - the buttons and textbox are arranged from left to right
14- Open the program, design the form as given in the figure above, and Make the form as bigger as possible. Drag the panel to the form and change the properties of it (Dock :Top) & ( backcolor: blue ), this panel will contain all the tools as shown below
2-Change the properties of the commands as shown in the table below Tools Property New property Button1 text back Button2 text forward Button3 text home Button4 text refresh Button5 text stop Button6 text Go Button7 text Search Google Label1 text url:- panel Dock top panel backcolor blue 3-Writing the code  Double-click the back button. And write the following code WebBrowser1.GoBack()  Double-click the forward button. And write the following code WebBrowser1.GoForward()  Double-click the home button. And write the following code WebBrowser1.GoHome()  Double-click the refresh button. And write the following code WebBrowser1.Refresh()  Double-click the stop button. And write the following code WebBrowser1.Stop()  Double-click the Go button. And write the following code
WebBrowser1.Navigate(TextBox1.Text)  Double-click the search Google button. And write the following code WebBrowser1.Navigate("http://www.google.com/search?q=" + TextBox2.Text) 4- Run the program Type (youtube.com & google.com& facebook.com & and anything you want in the textbox1) Type (help or printer or anything you want in the textbox 2) ……………………………………………………………………………… …………….. Example: - design a binary translator program that contain 2 textbox, 2 buttons, the final figure is as shown below 1- Open the program, design the form as given in the figure above, 2- Change the properties of the commands as shown in the table below
Tools Property New property Button1 text Text to binary code Button2 text Close Textbox1 Multiline True Textbox2 Multiline True 3-Writing the code  Double-click the text to binary code button. And write the following code If TextBox1.Text <> "" Then Dim result As New System.Text.StringBuilder Dim val As String = Nothing For Each character As Byte In System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox1.Text) result.Append(Convert.ToString(character, 2).PadLeft(8,"0") result.Append(" ") Next val = result.ToString.Substring(0, result.ToString.Length - 1) TextBox2.Text = val Else MsgBox(" enter the text u want to translate to binary code ") End If End Sub End Class  Double-click the close button. And write the following code End End sub 4 - Run the program
Discussion 1- Design a dictionary program that translate from English to Arabic and vise verse , use your imagination to control the design as you want it to be 2- What is the steps of connecting a vb.net to access? 3- Design professional calculator by using vb.net?
Use vb.net tools and Create an operating sysytem Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: eight
INTRODUCTION After completing this lecture, you will be able to: You will be able to create an operating system program. Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example:- Design an advance operating system by vb.net, follow the following steps 1- Open a new project that contain the following tools :- 2 panel, 7 buttons , the final figure will be as shown below Hint :- maximize the form as possible as you could, The panel 1 at the lower of the form and panel2 at the left, the panels contain the buttons as shown below
2- and change the properties of it as follows Tools Property New property Form1 text Operating system Form1 FormBorderStyle none Form1 Background Image Choose image from pictures Panel1 Background Image Choose image from pictures Panel2 Background Image Choose the same image earlier Button1 text Shut down Button2 text Advance start Button3 text start Button4 text Web browser Button5 text Notepad Button6 text Picture viewer Button7 text Settings
3- From project, choose your project (form1) properties Choose when last form closes from shutdown mode 4- writing the code  Double-click the form. choose click event And write the following code  Double-click the form. choose load event And write the following code  Double-click the start button. And write the following code  Double-click the advance start button. And write the following code  Double-click the shutdown button. And write the following code  Double-click the picture viewer button. And write the following code  Double-click the notepad button. And write the following code
 Double-click the web browser button. And write the following code  Double-click the setting button. And write the following code Msgbox(“coming soon”) 5- Add a new form (choose add windows form) from project and name it “advance start”, Change the properties of it as you do with form 1 , it contain 4 picturebox, the final figure is as shown below 6- Writing the code  Double click picture box1 and write the following code  Double click picture box2 and write the following code  Double click picture box3 and write the following code
 Double click picture box4 and write the following code 7- Add a new form (choose add windows form) from project and name it “web browser ”, it contain web browser , 1 textbox, 5 buttons ,The final figure of it is as shown below Hint:- the buttons are listed from left to right Drag the webbrowser to cover almost the form 8- change the properties of it as follows Tools Property New property Form1 Background Image Choose image from pictures
Button1 text << Button2 text >> Button3 text refresh Button4 text stop Button5 text Go 9- Writing the code  Double click GO button and write the following code  Double click stop button and write the following code  Double click refresh button and write the following code  Double click >> button and write the following code  Double click << button and write the following code 10- Add a new form (choose add windows form) from project and name it “notepad”, it contain 1 textbox, Choose multiline and drag the textbox to cover the entire form, the final figure of it is as shown below
11- change the properties of it as follows Tools Property New property textbox multiline true textbox dock fill 12- Add a new form (choose add windows form) from project and name it “loading”, it contain progress bar, label ,timer , the final figure is as shown below 13- change the properties of it as follows Tools Property New property label text Nimitproductions creation
Form FormBorderStyle none 14- Writing the code  Double click timer and write the following code  Double click form and write the following code 15- Add a new form (choose add windows form) from project and name it “user name and password”, it contain 2 textbox,2 label ,1 label link , 2 buttons , the final figure is as shown below 16- change the properties of it as follows
Tools Property New property Label1 text username Label2 text password linklabel text Create account Button1 text login Button2 text close Textbox2 PasswardChar * 17- Writing the code  Double click close button and write the following code  Double click create account button and write the following code  Double click login button and write the following code 18- From project select add service reference Choose loading from start up from as shown below
Choose setting and type the following as shown in the figure below Close the window and save changes by click on yes 19- Add a new form (choose add windows form) from project and name it “account creation ”, it contain 2 textbox,2 label , 2 buttons , the final figure is as shown below
20- change the properties of it as follows Tools Property New property Label1 text username Label2 text password Button1 text Create Button2 text close Textbox2 PasswardChar * 21- Writing the code  Double click close button and write the following code  Double click create button and write the following code
22- Add a new form (choose add windows form) from project and name it “picture viewer ”, it contain 1 picturebox, openFileDialog , menuStrip , the menu is as shown below The final figure is as shown below 23- Writing the code  Double click open button in the file menu and write the following code
24- Run the program
Design games by vb.net Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: nine
INTRODUCTION In this lecture, we will design games by visual basic.net. PROCEDURE:- Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example:- Design competition game by Vb .net , it contain 8 labels, DateTimePicker, tap control, 5 group box , 15 radio buttons, timer as shown below
1- Open the program and design it as given in the figure above 2- Add tap control that contain 2 tap pages 3- Add 3 buttons to the tap page 1 as given below 4- Add 2 buttons to the tap page 2 as given below
5- Add group box that contain 3 radio buttons consequently as given in the form above 6- Change the characteristic of the tools as given below tool property New property form text ‫مسابقات‬ ‫يرنامج‬ Label 1 text ‫المتسابق‬ ‫اسم‬ Label 4 text ‫فيها‬ ‫ذكر‬ ‫التي‬ ‫الصروة‬ ‫ماهي‬ ‫البعوض‬‫؟؟‬ Label 5 text ‫نظام‬ ‫عرف‬ ‫من‬ ‫اول‬ ‫من‬ ‫االنتخابات؟؟‬ Label 6 text ‫للباذنجان؟؟‬ ‫االصلي‬ ‫الموطن‬ ‫ما‬ Label 7 text ‫السيرك؟؟‬ ‫عرف‬ ‫من‬ ‫اول‬ ‫من‬ Label 8 text ‫في‬ ‫ذكروا‬ ‫الذين‬ ‫االنبياء‬ ‫عدد‬ ‫كم‬ ‫؟؟‬ ‫القران‬ Group box Text Radio button 1 Text ‫مريم‬ Radio button 2 Text ‫البقرة‬ Radio button 3 Text ‫النساء‬ Radio button 4 Text ‫المصريين‬ ‫قدماء‬ Radio button5 Text ‫الصينين‬ ‫قدماء‬ Radio button 6 Text ‫اليونان‬ ‫قدماء‬ Radio button 7 Text ‫الهند‬ Radio button 8 Text ‫السودان‬ Radio button 9 Text ‫اثيوبيا‬ Radio button 01 Text ‫الرومان‬ Radio button 10 Text ‫البابلين‬ Radio button 12 Text ‫الفينقين‬ Radio button 13 Text 23 Radio button 14 Text 24 Radio button 15 Text 25 timer interval 1000 timer enabled true
Tap control Tap pages Collection/ tap page1/ text / ‫النموذج‬ ‫خلفية‬ ‫الوان‬ Collection/ tap page1/ text /‫الشفافية‬ Button 1 Text ‫احمر‬ Button 2 Text ‫ابيض‬ Button 3 Text ‫قمحي‬ Button 4 Text ‫شفافية‬ ‫اكثر‬ Button 5 Text ‫استعادة‬ Button 6 Text ‫الدرجة‬ Button 7 Text ‫مسح‬ Button 8 Text ‫خروج‬ 7- Writing the code  Double click the button 1 ‫احمر‬ and write the following code  Double click the button 2 ‫ابيض‬ and write the following code  Double click the button3 ‫قمحي‬ and write the following code  Double click the button 4 ‫شفافية‬ ‫اكثر‬ and write the following code
 Double click the button 5 ‫استعادة‬ and write the following code  Double click the button ‫الدرجة‬ 6 and write the following code  Double click the button ‫امسح‬6 and write the following code
 Double click the button ‫خروج‬7 and write the following code  Double click the timer and write the following code  Double click the form and write the following code
8- Run the program Example:- Design amaze game by Vb .net , it contain panel , 41 label as shown below
9- Open the program and design it as given in the figure above 10- Drag a panel to the form and make the panel cover the form size 11- Drag a label to the form and change the properties as given by the table below 12- Copy/ baste the label and make 21 copies of it 13- Change the size of label 1 to (460,440) and make 20 copy of it 14- Change the characteristic of the tools as given below tool property New property form size 500,500 form Maximizebox false panel Border style Fixed 3d label autosize false label text label Back color Web/ forest green 15- Design the labels on the form as given in the form above 16- Drag anew label to the form and change the name/ text of it to finish as shown in the figure above 17- Double click the label finish and choose MouseEnter event and write the following code
10 – Choose form/ declaration event and add a new (private sub MoveToStart) as shown below/ see point 11 11 – Add a new (private sub MoveToStart) after (end sub) of the label finish / type the following
11 - Add a new (public sub new () ) after (public class) as shown below and type the following code 12- Select the mouse enter event of the first label and type Wall_ MouseEnter as given below
13- Double click the Wall_ MouseEnter of the label and write the following code 14- return to the form and choose select all from edit and repeat the point 12 again as shown below 15- Run the program
Lecture one Discussion 1- What the steps of open visual basic.net & the steps are of write an application Open the program Start/ programs/ Microsoft visual studio 2008/ Microsoft visual studio 2008 / or any version of the program File/new project/windows form application Write a Visual Basic application Writing Visual Basic Projects When we write a Visual Basic application, we follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When we plan the user interface, we draw a sketch of the screens the user will see when running our project. On our sketch, we show the forms and all the controls that we plan to use. Indicate the names that we plan to give the form and each of the objects on the form. Before we proceed with any more steps, we must consult with our user and make sure that we both agree on the look and feel of the project. 2. Plan the properties. For each object, we write down the properties that we plan to set or change during the design of the form. 3. Plan the Basic code. In this step, we plan the classes and procedures that will execute when our project runs. We will determine which events require action to be taken and then make a step-by-step plan for those actions.
2- Design a program that contain one command button called “calculator” and 3 text box, when press this button, it calculate the sum of the three numbers that entered in the textboxes Dim num1,num2,num3,sum as single Num1=textbox1.text Num2=textbox2.text Num3=textbox3.text sum = num1 + num2+num3 MsgBox(" The Sum of " & num1 & " and " & num2 & “and” & num3& " is " & sum) 3- Design a program that contain one command button called “sum”, when press this button, a message box appears and gives the sum of four numbers. Calculator Sum
Dim num1, num2,num3,num4, sum As Single num1 = 100 num2 = 200 num3 = 300 num4 = 400 sum = num1 + num2+num3+num4 MsgBox(" The Sum of " & num1 & " and " & num2 & “and” &num3& “and” &num4& " is " & sum) End Sub …………………………………………………………………………………… Lecture 2 Discussion 6- Design a program contain two buttons named (Ahmed, Ali), when click on the first button, a message box appear and showed “hello Ahmed”, and when click on the second button, a message box appear and showed “hello Ali”. Privatesub button 1….etc Messagebox.show (“hello Ahmed”) Privatesub button 2….etc Messagebox.show (“hello Ali”) Ahmed Ali
7- Design a program that calculate the following equation N= X + y + z + b / v * c Each of the input variables is entered during the execution of the program Dim x, y, z, b, v, c, N, as single x=textbox1.text y=textbox2.text z=textbox3.text b=textbox4.text v=textbox5.text c=textbox6.text N= x+y +z +b / (v*c) Textbox7.text = N 8- How to change the properties of a specific button? Give 2 ways. By windows properties or by the command window through programing X Y Z b v c N Calculate
Lecture 3 Discussion 9- Design a program contain four labels named (Facebook, mail, google, yahoo), and four linklabel dedicated to the names of the labels, when click on them, it opens a webpage dedicated to the names of the label.  Double-click the facebook linklabel on the form. And we write the following code System.Diagnostics.Process.Start _("http://www.facebook.com")  Double-click the mail linklabel on the form. And we write the following code System.Diagnostics.Process.Start _("http://www.mail.com")  Double-click the google linklabel on the form. And we write the following code System.Diagnostics.Process.Start _("http://www.google.com")  Double-click the yahoo linklabel on the form. And we write the following code System.Diagnostics.Process.Start _("http://www.yahoo.com") Facebook http://www.facebook.com http://www.yahoo.com http://www.Google.com http://www.mail.com Yahoo Google Mail
……………………………………. 10- Design a program that calculate the following equation N= 𝑋2 + 𝑦2 / 𝑣2 * 𝑐2 Each of the input variables is entered during the execution of the program Dim x,y,v,c,N as single x=textbox1.text y=textbox2.text v=textbox3.text c=textbox4.text N= (x*x + y*y)/ (v*v * c*c) textbox5.text=N X y v c N Calculate
Lecture 4 Discussion 3- Design a program that contain two button and two labels, when click the command show, the program shows a variable name “ last name” in the label 1 , and change the name variable “last name” to “Bodenstein von Karlstadt” and showes it in the label 2 at the same time as shown in the figure below.  Double-click the show button And we write the following code Dim LastName As String LastName = "Luther" Label1.Text = LastName LastName = "Bodenstein von Karlstadt" Label2.Text = LastName End Sub  Double-click the quit button And we write the following code End End Sub 4- Design a program that contain two button and one labels, when click the command “input box”, the program shows input box asked you to enter
your name , when you enter your name and click ok , your name shows in the label as shown in the figure below.  Double-click the input box button And we write the following code Dim Prompt, FullName As String Prompt = "Please enter your name." FullName = InputBox(Prompt) Label1.Text = FullName End Sub  Double-click the quit button And we write the following code End End Sub
Lecture 6 Discussion 3- Design a program for a school to calculate students course1 average, course2 average , midterm average and the final state as shown in the figure below Code generation Double click the ‫"احسب‬‫بلفصل‬ ‫الخاص‬"‫االول‬ and write the following code
Double click the ‫الخانات‬ ‫"تفريغ‬"‫االول‬ ‫بلفصل‬ ‫الخاص‬ and write the following code Double click the ‫"احسب‬"‫السنة‬ ‫بنصف‬ ‫الخاص‬ and write the following code
Double click the button ON and write the following code Double click the button OFF and write the following code
4- Design an illusion chat program, when write in the textbox1 and click send, the respond of the second person appears in the textbox2 at the same time as shown in the figure bellow. In this question, we use two textbox and one button, change the properties of textbox multiline to true and arrange the form as shown above  Double-click the button send. And we write the following code
Lecture 7 Discussion 4- Design a dictionary program that translate from English to Arabic and vise verse , use your imagination to control the design as you want it to be We design the form as shown below, by add two textbox, one list box and one label  We Double-click the form. And write the following code Listbox1.items. add (“summer”) Listbox1.items. add (“wrong”) Listbox1.items. add (“communication”) Listbox1.items. add (“satellite”) Listbox1.items. add (“mother”) Listbox1.items. add (“faith”) Listbox1.items. add (“cheat”) Listbox1.items. add (“latitude”)
Listbox1.items. add (“longitude”) Listbox1.items. add (“nurse”) Listbox1.items. add (“designer”) Listbox1.items. add (“book”) Listbox1.items. add (“pole”) Listbox1.sorted= true  We Double-click the search button. And write the following code If textbox1.text= “summer” then Textbox2.text= “ ‫الصيف‬ " Else if textbox1.text= “wrong” then Textbox2.text= “ ‫خطا‬ " Else if textbox1.text= “communication” then Textbox2.text= “ ‫اتصاالت‬ " Else if textbox1.text= “satellite” then Textbox2.text= “ ‫صناعي‬ ‫قمر‬ " Else if textbox1.text= “mother” then Textbox2.text= “ ‫ام‬-‫والدة‬ " Else if textbox1.text= “faith” then Textbox2.text= “ ‫ايمان‬-‫قدر‬ " Else if textbox1.text= “cheat” then Textbox2.text= “ ‫يغش‬-‫يتحايل‬ " Else if textbox1.text= “latitude” then Textbox2.text= “ ‫العرض‬ ‫خطوط‬ " Else if textbox1.text= “longitude” then Textbox2.text= “ ‫الطول‬ ‫خطوط‬ " Else if textbox1.text= “nurse” then Textbox2.text= “ ‫ممرضة‬-‫طبيب‬ ‫مساعدة‬ " Else if textbox1.text= “designer” then
Textbox2.text= “ ‫مصمم‬ " Else if textbox1.text= “book” then Textbox2.text= “ ‫كتاب‬ " Else if textbox1.text= “pole” then Textbox2.text= “ ‫قطب‬ " 5- What is the steps of connecting a vb.net to access?  First of all we Open the access and create a simple table  We Save the program in documents and named it Yousef  We Open vb.net and open a new project  We Choose “ add new data source” from project  We choose database and click next  Again We choose database and click next  New connection / browse/ and then we choose Yousef database that we created/ ok/next  We save the connection by clicking on yes, save the connection as and click next  We Select all icons from choose your database objects and click finish  We drag the table to the form, the table will show up on the form 6- Design professional calculator by using vb.net?
 We Double-click the 0 button. And write the following code Textbox1.text= textbox1.text + “0”  We Double-click the 1 button. And write the following code Textbox1.text= textbox1.text + “1”  We Double-click the 2 button. And write the following code Textbox1.text= textbox1.text + “2”  We Double-click the 3 button. And write the following code Textbox1.text= textbox1.text + “3”  We Double-click the 4 button. And write the following code Textbox1.text= textbox1.text + “4”  We Double-click the 5 button. And write the following code Textbox1.text= textbox1.text + “5”  We Double-click the 6 button. And write the following code Textbox1.text= textbox1.text + “6”
 We Double-click the 7 button. And write the following code Textbox1.text= textbox1.text + “7”  We Double-click the 8 button. And write the following code Textbox1.text= textbox1.text + “8”  We Double-click the 9 button. And write the following code Textbox1.text= textbox1.text + “9”  We Double-click the. button. And write the following code Textbox1.text= textbox1.text + “.”  We Double-click the c button. And write the following code  We Double-click the form. And write the following code Public n1,n2 as double Dim st as string  We Double-click the + button. And write the following code  We Double-click the * button. And write the following code  We Double-click the - button. And write the following code
 We Double-click the / button. And write the following code  We Double-click the = button. And write the following code If st= “𝑥∧ ” then Textbox1.text= 𝑛1∧𝑛2  We Double-click the 1/x button. And write the following code  We Double-click the − + button. And write the following code  We Double-click the √ button. And write the following code
 We Double-click the 𝑥∧ button. And write the following code n1=val (textbox1.text) St=”𝑥∧ “ Textbox1. Clear ()

Software engineering modeling lab lectures

  • 1.
    2015 Marwa moutaz [Company name] 1/1/2015 Softwareengineering modeling lab lectures
  • 2.
    This series oflectures was prepared for the third class of software engineering / Aliraqia University/ Baghdad/ Iraq. In prepared these lectures, I depend on the YouTube to make it, the programs of the lectures are designed and executed by vb.net, discussions are also found here These lectures are not finished yet, i will improve it in the future Forgive me for anything wrong by mistake, I wish you can profit from these lectures My regard Marwa Moutaz/ M.Sc. studies of Communication Engineering / University of Technology/ Bagdad / Iraq.
  • 3.
    Introduction to Visual Basic.Net Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: One
  • 4.
    INTRODUCTION In this lecture,we will study an introduction to visual basic.net. Learn how to: open the program, study the basic windows properties and made a simple program by it. PROCEDURE:- Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Visual Basic.Net Environments  Open the program Start/ programs/ Microsoft visual studio 2008/ Microsoft visual studio 2008 / see figure 1.1
  • 5.
    Figure 1.1 openthe program  To start creating your first application, you need to click on file and select new project. Or choose create as shown in figure 1.2 , a new window is appear as shown in figure 1.3
  • 6.
    Figure 1.2 opena new project
  • 7.
    Figure 1.3 opena new application window  The Visual Studio environment appears. Each window can be moved, resized, closed, or customized.as shown in figure 1.4
  • 8.
    Figure 1.4 TheVisual Studio environment  The Toolbars You can use the buttons on the toolbars as shortcuts for frequently used operations. Each button represents a command that also can be selected from a menu. Figure 1.5 shows the toolbar buttons on the Standard toolbar for the Professional Edition, which displays in the main window of the IDE.
  • 9.
    Figure 1.5 theToolbars Example: Design a program that contain one command button called “calculator”, when press this button, a message box appears and gives the sum of two numbers.  First of all, drag one common button into the form and change its default name to calculate.  Next, click on the calculate button and key in the following code at the source code window as shown below. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim num1, num2, sum As Single num1 = 100 num2 = 200
  • 10.
    sum = num1+ num2 MsgBox(" The Sum of " & num1 & " and " & num2 & " is " & sum) End Sub  Now run your first application! And you can see the follow message box showing the sum of two numbers. Example: Design a program that contain one command button called “calculator” and two text box and 2 labels * & =, when press this button, it calculate the product of the two numbers that entered in the textboxes.
  • 11.
    Textbox3.text= product End sub Discussion 1-What the steps of open visual basic.net & the steps are of write an application. 2- Design a program that contain one command button called “calculator” and 3 text box, when press this button, it calculate the sum of the three numbers that entered in the textboxes. 3- Design a program that contain one command button called “sum”, when press this button, a message box appears and gives the sum of four numbers.
  • 12.
    Introduction to properties window& Create VB.NET applications Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: two
  • 13.
    INTRODUCTION In this lecture,we will create programs in visual basic. Net, learn how to use labels, textbox, pictures and change their properties by using windows properties. PROCEDURE:- Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example: - HELLO WORD Design a program that contain one button named “click me’’, when click this button a message box appear showed “hello word” as shown in the figure below.
  • 14.
    1- Open theprogram and design the form as given in figure above 2- Change the properties of the button as shown in the figure below (choose text and change the name of it to “click me “) 3- Writing the code  Double-click the button on the form. And write the following code 4- Run the program.
  • 15.
    Example: Lucky Seven: Designa game program that simulates a lucky number slot machine. Lucky Seven has a simple user interface as shown in figure 2.1 (a) design (b) execution, when a number 7 appears in one of the labels , a picture will shows up. (a) (b) Figure 2.1 (a) design (b) execution 1-Open the program and design the form as given in fig (2.1a)
  • 16.
    2-2Change the propertiesof the commands as shown in the table below Tools Property New property Button 1 Text spin Button 2 Text End Label 1 Text 0 Label 2 Text 0 Label 3 Text 0 Label 4 Text Lucky seven Picture box Image Size mode visible “c:vb08sbschap02paycoins.jpg” StretchImage False 3-Writing the code  Double-click the End button on the form. And write the following code Private Sub Button2_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button2.Click End End Sub  Double-click the spin button on the form. And write the following code Private Sub Button1_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles Button1.Click PictureBox1.Visible = False ' hide picture Label1.Text = CStr(Int(Rnd() * 10)) ' pick numbers Label2.Text = CStr(Int(Rnd() * 10)) Label3.Text = CStr(Int(Rnd() * 10)) ' if any number is 7 display picture and beep If (Label1.Text = "7") Or (Label2.Text = "7") _ Or (Label3.Text = "7") Then PictureBox1.Visible = True Beep() End If End Sub
  • 17.
     The codewill be as shown at finished 4- Run the program. Notes about code:- You then need to jump through a little hoop in your code. You need to copy these random numbers into the three label boxes on the form, but fi rst the numbers need to be converted to text with the CStr (convert to string) function. Notice how CStr, Int, and Rnd are all connected together in the program statement—they work collectively to produce a result like a mathematical formula
  • 18.
    Discussion 1- Design aprogram contain two buttons named (Ahmed, Ali), when click on the first button, a message box appear and showed “hello Ahmed”, and when click on the second button, a message box appear and showed “hello Ali”. 2- Design a program that calculate the following equation N= X + y + z + b / v * c Each of the input variables is entered during the execution of the program 3- How to change the properties of a specific button? Give 2 ways.
  • 19.
    Working with tool box Aliraqiauniversity Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: three
  • 20.
    INTRODUCTION In this lecture,we will create programs in visual basic. Net, learn how to use date time picker control and link label in simple programs. PROCEDURE:- Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example: - Birthday program Design a program that contain one button and one DateTimePicker control , when click this button a message box appear showed your birthday as shown in the figure below.
  • 21.
    3- Open theprogram and design the form as given in figure above 4- Change the properties of the button (choose text and change the name of it to “show my birthday “) 3- Writing the code  Double-click the button on the form. And write the following code MsgBox("Your birth date was " & DateTimePicker1.Text) MsgBox("Day of the year: " & DateTimePicker1.Value.DayOfYear.ToString()) 5- Run the program. Note The statement DateTimePicker1.Value.DayOfYear.ToString() uses the date/time picker object to calculate the day of the year in which you were born, counting from January 1. This is accomplished by the DayOfYear property and the ToString method, which converts the numeric result of the date calculation to a textual value that’s more easily displayed by the MsgBox function. Example: Web link program: Design a program that contain one link label, when click this link label, it open web page as shown in figure below.
  • 22.
    1- Open theprogram and design the form as given in figure above. 2-Change the properties of the linklabel as shown below:- Tools Property New property linklabel Text http://www.microsoft.com/learning/books/ 3-Writing the code  Double-click the linklabel on the form. And write the following code Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked ' Change the color of the link by setting LinkVisited to True. LinkLabel1.LinkVisited = True ' Use the Process.Start method to open the default browser ' using the Microsoft Press URL: System.Diagnostics.Process.Start _ ("http://www.microsoft.com/learning/books/") End Sub 4- Run the program.
  • 23.
    Example: simple calculatorprogram Design a simple calculator that contain one button called calculate and 3 text box and 4 radio button, as shown in figure below. 1- Open the program and design the form as given in figure above. 2-Change the properties of the tools as shown below:- Tools Property New property Button1 Text Calculate Radiobutton1 Text addition Radiobutton2 Text subtraction Radiobutton3 Text multiplication Radiobutton4 Text division 3-Writing the code  Double-click the calculate button on the form. And write the following code Private Sub button1_Click (ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
  • 24.
    Dim a asinteger Dim b as integer a= textbox1.text b= textbox2.text if radiobutton1.checked = true then textbox3.text= a+b elseif radiobutton2.checked = true then textbox3.text= a-b elseif radiobutton3.checked = true then textbox3.text= a*b elseif radiobutton4.checked = true then textbox3.text= a/b end if End Sub 4- Run the program. Discussion 4- Design a program contain four labels named (Facebook, mail, google, yahoo), and four linklabel dedicated to the names of the labels, when click on them, it opens a webpage dedicated to the names of the label. 5- Design a program that calculate the following equation N= 𝑋2 + 𝑦2 / 𝑣2 * 𝑐2 Each of the input variables is entered during the execution of the program
  • 25.
    Working with Menus, Toolbars,and Dialog Boxes Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: four
  • 26.
    INTRODUCTION After completing thislecture, you will be able to: � Add menus to your programs by using the MenuStrip control. �design a professional windows video player Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example: - Create a menu Design a program that contain a menu consist of two command (date & time) , one label , when click the command date, the date is appears in the label , and the same thing for the time as shown in the figure below.
  • 27.
    6- Open theprogram and create a new project. 7- Click the MenuStrip control on the Menus & Toolbars tab of the Toolbox, and then draw a menu control on your form. 8- Click the Type Here tag, type Clock, and then press Enter. 9- Type Date to create a Date command for the Clock menu, and then press Enter. 10- Type Time to create a Time command for the menu, and then press Enter. Your form looks like the one shown here:
  • 28.
    11- Add alabel object to the form 12- Change the properties of the button as shown by the table below 8- Writing the code  Double-click the time command in the clock menu. And write the following code Private Sub TimeToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimeToolStripMenuItem.Click Label1.Text = TimeString End sub  Double-click the date command in the clock menu. And write the following code Private Sub DateToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateToolStripMenuItem.Click Label1.Text = DateString End sub 9-Run the program. Note The TimeToolStripMenuItem_Click event procedure appears in the Code Editor. The name TimeToolStripMenuItem_Click includes the name Time that you gave this menu command. The words ToolStripMenuItem indicate that in its underlying technology, the MenuStrip control is related to the ToolStrip control. (We’ll see further examples of that later in this chapter.) The _Click syntax means that this is the event procedure that runs when a user clicks the menu item.
  • 29.
    Example: Create aprofessional video and voice player Design a professional video and voice player program that contain one windows media player, a menu [open, play, pause , resume, stop, about, exit ]and one OpenFileDialoge as shown in the figure below. 1-Open the program and create a new project. 2-add a windows media player , follow the steps in the figures below
  • 30.
    3- after chosewindows media player from COM component , drag it to the form as shown below , and change the property of it ( dock ------choose fill)
  • 31.
    4-add a menustrip to the form and an open file dialog, your figure should look like:-
  • 32.
    5-Writing the code Double-click the open menu. And write the following code  Double-click the play menu. And write the following code  Double-click the stop menu. And write the following code  Double-click the pause menu. And write the following code  Double-click the resume menu. And write the following code  Double-click the about menu. And write the following code
  • 33.
     Double-click theexit menu. And write the following code 6- Run the program. Discussion 1- Design a program that contain two button and two labels, when click the command show, the program shows a variable name “ last name” in the label 1 , and change the name variable “last name” to “Bodenstein von Karlstadt” and showes it in the label 2 at the same time as shown in the figure below. 2- Design a program that contain two button and one labels, when click the command “input box”, the program shows input box asked you to enter your name , when you enter your name and click ok , your name shows in the label as shown in the figure below.
  • 35.
    Connect access data baseto vb.net and create your program Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: four
  • 36.
    INTRODUCTION After completing thislecture, you will be able to: Connect access data base to vb.net and create your first real program Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example: - connect access to vb.net Steps of work 1- Open the access and create a simple table as shown below
  • 37.
    2- Save theprogram in documents and named it yousif 3- Open vb.net and open a new project 4- Choose “ add new data source” from project as shown below and follow the steps in the pictures
  • 41.
    5- Select thetable and click finish as shown in the figure below
  • 42.
    If the datasource doesn’t exsisit on the program at the upper corner , go to :- From view choose other windows and then select data source Show the detail of the table as shown below 6- Drag the table to the form , it will appear on the form as shown below
  • 43.
    7- Now ,we will make the program work even it doesn’t open by vb.net ,choose purplish windows application option from build menu , follow the pictures below Click brose and choose the location you want to save the program on it , choose desktop as shown below
  • 48.
    Use vb.net toolsand Create a calendar & run programs Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: six
  • 49.
    INTRODUCTION After completing thislecture, you will be able to: You will be able to create a professional calendar program. Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example: - design a calendar program that contain a menu (file, edit, format, help) and a textbox, the contents of the menus are as shown in the figures below
  • 51.
    The final figureof the program is as shown below 13- Open the program ,add menu strip and textbox, design the form as given in the figure above 2-Change the properties of the commands as shown in the table below Tools Property New property form Text ‫المفكرة‬ textbox multiline true textbox dock fill textbox maxlength 0 textbox scrollbar vertical textbox Font Font Font style size Arial Regular 18 3-Writing the code  Double-click the button new in the file menu. And write the following code
  • 52.
     Double-click thebutton open in the file menu. And write the following code  Double-click the button exit in the file menu. And write the following code  Double-click the button undo in the edit menu. And write the following code  Double-click the button select all in the edit menu. And write the following code
  • 53.
     Double-click thebutton paste in the edit menu. And write the following code  Double-click the button copy in the edit menu. And write the following code  Double-click the button cut in the edit menu. And write the following code  Double-click the button clear in the edit menu. And write the following code
  • 54.
     Double-click thebutton insert time and date in the edit menu. And write the following code  Double-click the button font in the format menu. And write the following code  Double-click the button text color in the format menu. And write the following code  Double-click the button back color in the format menu. And write the following code
  • 55.
     Double-click thebutton about in the help menu. And write the following code Messagebox.show (“calendar program”) 4-Run the program Write any sentence and try the choices from the calendar program Example: RUN program Design a RUN program that contain one textbox, 3 buttons, and one picture box, it uses to open any program safely, its work is similar to the run program of the computer, the final program is as shown in the figure below 1-Open the program and design the form as given in the fig above, add picture box and drag it to cover all the form as shown in the fig below , and then right click and choose send to back , the tools will show up again
  • 56.
    2-Change the propertiesof the commands as shown in the table below Tools Property New property form 1 Text Run program Button 1 Text RUN Button 2 Text about Button 3 Text exit Picyurebox1 Image sizemode Choose image from computer stretch 3-Writing the code  Double-click the RUN button on the form. And write the following code  Double-click the about button on the form. And write the following code Msgbox (“RUN PROGRAM”) End Sub  Double-click the exit button on the form. And write the following code End Endsub
  • 57.
    4- Run theprogram, write in the textbox sequentially (write, notepad)
  • 58.
    Discussion 1- Design aprogram for a school to calculate students course1 average, course2 average , midterm average and the final state as shown in the figure below 2- Design an illusion chat program, when write in the textbox1 and click send, the respond of the second person appears in the textbox2 at the same time as shown in the figure bellow.
  • 59.
    Use vb.net toolsand Create a web browser & binary translator Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: seven
  • 60.
    INTRODUCTION After completing thislecture, you will be able to: You will be able to create a professional web browser program and a binary translator. Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example: - design a web browser program that contain, 1 panel, 7 buttons, 2 textbox, 1 label, webbrowser, the final figure is as shown below Hint: - the buttons and textbox are arranged from left to right
  • 61.
    14- Open theprogram, design the form as given in the figure above, and Make the form as bigger as possible. Drag the panel to the form and change the properties of it (Dock :Top) & ( backcolor: blue ), this panel will contain all the tools as shown below
  • 62.
    2-Change the propertiesof the commands as shown in the table below Tools Property New property Button1 text back Button2 text forward Button3 text home Button4 text refresh Button5 text stop Button6 text Go Button7 text Search Google Label1 text url:- panel Dock top panel backcolor blue 3-Writing the code  Double-click the back button. And write the following code WebBrowser1.GoBack()  Double-click the forward button. And write the following code WebBrowser1.GoForward()  Double-click the home button. And write the following code WebBrowser1.GoHome()  Double-click the refresh button. And write the following code WebBrowser1.Refresh()  Double-click the stop button. And write the following code WebBrowser1.Stop()  Double-click the Go button. And write the following code
  • 63.
    WebBrowser1.Navigate(TextBox1.Text)  Double-click thesearch Google button. And write the following code WebBrowser1.Navigate("http://www.google.com/search?q=" + TextBox2.Text) 4- Run the program Type (youtube.com & google.com& facebook.com & and anything you want in the textbox1) Type (help or printer or anything you want in the textbox 2) ……………………………………………………………………………… …………….. Example: - design a binary translator program that contain 2 textbox, 2 buttons, the final figure is as shown below 1- Open the program, design the form as given in the figure above, 2- Change the properties of the commands as shown in the table below
  • 64.
    Tools Property Newproperty Button1 text Text to binary code Button2 text Close Textbox1 Multiline True Textbox2 Multiline True 3-Writing the code  Double-click the text to binary code button. And write the following code If TextBox1.Text <> "" Then Dim result As New System.Text.StringBuilder Dim val As String = Nothing For Each character As Byte In System.Text.ASCIIEncoding.ASCII.GetBytes(TextBox1.Text) result.Append(Convert.ToString(character, 2).PadLeft(8,"0") result.Append(" ") Next val = result.ToString.Substring(0, result.ToString.Length - 1) TextBox2.Text = val Else MsgBox(" enter the text u want to translate to binary code ") End If End Sub End Class  Double-click the close button. And write the following code End End sub 4 - Run the program
  • 65.
    Discussion 1- Design adictionary program that translate from English to Arabic and vise verse , use your imagination to control the design as you want it to be 2- What is the steps of connecting a vb.net to access? 3- Design professional calculator by using vb.net?
  • 66.
    Use vb.net toolsand Create an operating sysytem Aliraqia university Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: eight
  • 67.
    INTRODUCTION After completing thislecture, you will be able to: You will be able to create an operating system program. Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example:- Design an advance operating system by vb.net, follow the following steps 1- Open a new project that contain the following tools :- 2 panel, 7 buttons , the final figure will be as shown below Hint :- maximize the form as possible as you could, The panel 1 at the lower of the form and panel2 at the left, the panels contain the buttons as shown below
  • 68.
    2- and changethe properties of it as follows Tools Property New property Form1 text Operating system Form1 FormBorderStyle none Form1 Background Image Choose image from pictures Panel1 Background Image Choose image from pictures Panel2 Background Image Choose the same image earlier Button1 text Shut down Button2 text Advance start Button3 text start Button4 text Web browser Button5 text Notepad Button6 text Picture viewer Button7 text Settings
  • 69.
    3- From project,choose your project (form1) properties Choose when last form closes from shutdown mode 4- writing the code  Double-click the form. choose click event And write the following code  Double-click the form. choose load event And write the following code  Double-click the start button. And write the following code  Double-click the advance start button. And write the following code  Double-click the shutdown button. And write the following code  Double-click the picture viewer button. And write the following code  Double-click the notepad button. And write the following code
  • 70.
     Double-click theweb browser button. And write the following code  Double-click the setting button. And write the following code Msgbox(“coming soon”) 5- Add a new form (choose add windows form) from project and name it “advance start”, Change the properties of it as you do with form 1 , it contain 4 picturebox, the final figure is as shown below 6- Writing the code  Double click picture box1 and write the following code  Double click picture box2 and write the following code  Double click picture box3 and write the following code
  • 71.
     Double clickpicture box4 and write the following code 7- Add a new form (choose add windows form) from project and name it “web browser ”, it contain web browser , 1 textbox, 5 buttons ,The final figure of it is as shown below Hint:- the buttons are listed from left to right Drag the webbrowser to cover almost the form 8- change the properties of it as follows Tools Property New property Form1 Background Image Choose image from pictures
  • 72.
    Button1 text << Button2text >> Button3 text refresh Button4 text stop Button5 text Go 9- Writing the code  Double click GO button and write the following code  Double click stop button and write the following code  Double click refresh button and write the following code  Double click >> button and write the following code  Double click << button and write the following code 10- Add a new form (choose add windows form) from project and name it “notepad”, it contain 1 textbox, Choose multiline and drag the textbox to cover the entire form, the final figure of it is as shown below
  • 73.
    11- change theproperties of it as follows Tools Property New property textbox multiline true textbox dock fill 12- Add a new form (choose add windows form) from project and name it “loading”, it contain progress bar, label ,timer , the final figure is as shown below 13- change the properties of it as follows Tools Property New property label text Nimitproductions creation
  • 74.
    Form FormBorderStyle none 14-Writing the code  Double click timer and write the following code  Double click form and write the following code 15- Add a new form (choose add windows form) from project and name it “user name and password”, it contain 2 textbox,2 label ,1 label link , 2 buttons , the final figure is as shown below 16- change the properties of it as follows
  • 75.
    Tools Property Newproperty Label1 text username Label2 text password linklabel text Create account Button1 text login Button2 text close Textbox2 PasswardChar * 17- Writing the code  Double click close button and write the following code  Double click create account button and write the following code  Double click login button and write the following code 18- From project select add service reference Choose loading from start up from as shown below
  • 76.
    Choose setting andtype the following as shown in the figure below Close the window and save changes by click on yes 19- Add a new form (choose add windows form) from project and name it “account creation ”, it contain 2 textbox,2 label , 2 buttons , the final figure is as shown below
  • 77.
    20- change theproperties of it as follows Tools Property New property Label1 text username Label2 text password Button1 text Create Button2 text close Textbox2 PasswardChar * 21- Writing the code  Double click close button and write the following code  Double click create button and write the following code
  • 78.
    22- Add anew form (choose add windows form) from project and name it “picture viewer ”, it contain 1 picturebox, openFileDialog , menuStrip , the menu is as shown below The final figure is as shown below 23- Writing the code  Double click open button in the file menu and write the following code
  • 79.
    24- Run theprogram
  • 80.
    Design games by vb.net Aliraqiauniversity Software Engineers /third class Lecturer : Marwa Moutaz Lab Lecture: nine
  • 81.
    INTRODUCTION In this lecture,we will design games by visual basic.net. PROCEDURE:- Write a Visual Basic application Writing Visual Basic Projects When you write a Visual Basic application, you follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When you plan the user interface, you draw a sketch of the screens the user will see when running your project. On your sketch, show the forms and all the controls that you plan to use. Indicate the names that you plan to give the form and each of The objects on the form. Before you proceed with any more steps, consult with your user and make sure that you both agree on the look and feel of the project. 2. Plan the properties. For each object, write down the properties that you plan to set or change during the design of the form. 3. Plan the Basic code. In this step, you plan the classes and procedures that will execute when your project runs. You will determine which events require action to be taken and then make a step-by-step plan for those actions. Example:- Design competition game by Vb .net , it contain 8 labels, DateTimePicker, tap control, 5 group box , 15 radio buttons, timer as shown below
  • 82.
    1- Open theprogram and design it as given in the figure above 2- Add tap control that contain 2 tap pages 3- Add 3 buttons to the tap page 1 as given below 4- Add 2 buttons to the tap page 2 as given below
  • 83.
    5- Add groupbox that contain 3 radio buttons consequently as given in the form above 6- Change the characteristic of the tools as given below tool property New property form text ‫مسابقات‬ ‫يرنامج‬ Label 1 text ‫المتسابق‬ ‫اسم‬ Label 4 text ‫فيها‬ ‫ذكر‬ ‫التي‬ ‫الصروة‬ ‫ماهي‬ ‫البعوض‬‫؟؟‬ Label 5 text ‫نظام‬ ‫عرف‬ ‫من‬ ‫اول‬ ‫من‬ ‫االنتخابات؟؟‬ Label 6 text ‫للباذنجان؟؟‬ ‫االصلي‬ ‫الموطن‬ ‫ما‬ Label 7 text ‫السيرك؟؟‬ ‫عرف‬ ‫من‬ ‫اول‬ ‫من‬ Label 8 text ‫في‬ ‫ذكروا‬ ‫الذين‬ ‫االنبياء‬ ‫عدد‬ ‫كم‬ ‫؟؟‬ ‫القران‬ Group box Text Radio button 1 Text ‫مريم‬ Radio button 2 Text ‫البقرة‬ Radio button 3 Text ‫النساء‬ Radio button 4 Text ‫المصريين‬ ‫قدماء‬ Radio button5 Text ‫الصينين‬ ‫قدماء‬ Radio button 6 Text ‫اليونان‬ ‫قدماء‬ Radio button 7 Text ‫الهند‬ Radio button 8 Text ‫السودان‬ Radio button 9 Text ‫اثيوبيا‬ Radio button 01 Text ‫الرومان‬ Radio button 10 Text ‫البابلين‬ Radio button 12 Text ‫الفينقين‬ Radio button 13 Text 23 Radio button 14 Text 24 Radio button 15 Text 25 timer interval 1000 timer enabled true
  • 84.
    Tap control Tappages Collection/ tap page1/ text / ‫النموذج‬ ‫خلفية‬ ‫الوان‬ Collection/ tap page1/ text /‫الشفافية‬ Button 1 Text ‫احمر‬ Button 2 Text ‫ابيض‬ Button 3 Text ‫قمحي‬ Button 4 Text ‫شفافية‬ ‫اكثر‬ Button 5 Text ‫استعادة‬ Button 6 Text ‫الدرجة‬ Button 7 Text ‫مسح‬ Button 8 Text ‫خروج‬ 7- Writing the code  Double click the button 1 ‫احمر‬ and write the following code  Double click the button 2 ‫ابيض‬ and write the following code  Double click the button3 ‫قمحي‬ and write the following code  Double click the button 4 ‫شفافية‬ ‫اكثر‬ and write the following code
  • 85.
     Double clickthe button 5 ‫استعادة‬ and write the following code  Double click the button ‫الدرجة‬ 6 and write the following code  Double click the button ‫امسح‬6 and write the following code
  • 86.
     Double clickthe button ‫خروج‬7 and write the following code  Double click the timer and write the following code  Double click the form and write the following code
  • 87.
    8- Run theprogram Example:- Design amaze game by Vb .net , it contain panel , 41 label as shown below
  • 88.
    9- Open theprogram and design it as given in the figure above 10- Drag a panel to the form and make the panel cover the form size 11- Drag a label to the form and change the properties as given by the table below 12- Copy/ baste the label and make 21 copies of it 13- Change the size of label 1 to (460,440) and make 20 copy of it 14- Change the characteristic of the tools as given below tool property New property form size 500,500 form Maximizebox false panel Border style Fixed 3d label autosize false label text label Back color Web/ forest green 15- Design the labels on the form as given in the form above 16- Drag anew label to the form and change the name/ text of it to finish as shown in the figure above 17- Double click the label finish and choose MouseEnter event and write the following code
  • 89.
    10 – Chooseform/ declaration event and add a new (private sub MoveToStart) as shown below/ see point 11 11 – Add a new (private sub MoveToStart) after (end sub) of the label finish / type the following
  • 90.
    11 - Adda new (public sub new () ) after (public class) as shown below and type the following code 12- Select the mouse enter event of the first label and type Wall_ MouseEnter as given below
  • 91.
    13- Double clickthe Wall_ MouseEnter of the label and write the following code 14- return to the form and choose select all from edit and repeat the point 12 again as shown below 15- Run the program
  • 92.
    Lecture one Discussion 1- Whatthe steps of open visual basic.net & the steps are of write an application Open the program Start/ programs/ Microsoft visual studio 2008/ Microsoft visual studio 2008 / or any version of the program File/new project/windows form application Write a Visual Basic application Writing Visual Basic Projects When we write a Visual Basic application, we follow a three-step process for planning the project and then repeat the three-step process for creating the project. The three steps involve setting up the user interface, defining the properties, and then creating the code. The Three-Step Process 1. Design the user interface. When we plan the user interface, we draw a sketch of the screens the user will see when running our project. On our sketch, we show the forms and all the controls that we plan to use. Indicate the names that we plan to give the form and each of the objects on the form. Before we proceed with any more steps, we must consult with our user and make sure that we both agree on the look and feel of the project. 2. Plan the properties. For each object, we write down the properties that we plan to set or change during the design of the form. 3. Plan the Basic code. In this step, we plan the classes and procedures that will execute when our project runs. We will determine which events require action to be taken and then make a step-by-step plan for those actions.
  • 93.
    2- Design aprogram that contain one command button called “calculator” and 3 text box, when press this button, it calculate the sum of the three numbers that entered in the textboxes Dim num1,num2,num3,sum as single Num1=textbox1.text Num2=textbox2.text Num3=textbox3.text sum = num1 + num2+num3 MsgBox(" The Sum of " & num1 & " and " & num2 & “and” & num3& " is " & sum) 3- Design a program that contain one command button called “sum”, when press this button, a message box appears and gives the sum of four numbers. Calculator Sum
  • 94.
    Dim num1, num2,num3,num4,sum As Single num1 = 100 num2 = 200 num3 = 300 num4 = 400 sum = num1 + num2+num3+num4 MsgBox(" The Sum of " & num1 & " and " & num2 & “and” &num3& “and” &num4& " is " & sum) End Sub …………………………………………………………………………………… Lecture 2 Discussion 6- Design a program contain two buttons named (Ahmed, Ali), when click on the first button, a message box appear and showed “hello Ahmed”, and when click on the second button, a message box appear and showed “hello Ali”. Privatesub button 1….etc Messagebox.show (“hello Ahmed”) Privatesub button 2….etc Messagebox.show (“hello Ali”) Ahmed Ali
  • 95.
    7- Design aprogram that calculate the following equation N= X + y + z + b / v * c Each of the input variables is entered during the execution of the program Dim x, y, z, b, v, c, N, as single x=textbox1.text y=textbox2.text z=textbox3.text b=textbox4.text v=textbox5.text c=textbox6.text N= x+y +z +b / (v*c) Textbox7.text = N 8- How to change the properties of a specific button? Give 2 ways. By windows properties or by the command window through programing X Y Z b v c N Calculate
  • 96.
    Lecture 3 Discussion 9- Designa program contain four labels named (Facebook, mail, google, yahoo), and four linklabel dedicated to the names of the labels, when click on them, it opens a webpage dedicated to the names of the label.  Double-click the facebook linklabel on the form. And we write the following code System.Diagnostics.Process.Start _("http://www.facebook.com")  Double-click the mail linklabel on the form. And we write the following code System.Diagnostics.Process.Start _("http://www.mail.com")  Double-click the google linklabel on the form. And we write the following code System.Diagnostics.Process.Start _("http://www.google.com")  Double-click the yahoo linklabel on the form. And we write the following code System.Diagnostics.Process.Start _("http://www.yahoo.com") Facebook http://www.facebook.com http://www.yahoo.com http://www.Google.com http://www.mail.com Yahoo Google Mail
  • 97.
    ……………………………………. 10- Design aprogram that calculate the following equation N= 𝑋2 + 𝑦2 / 𝑣2 * 𝑐2 Each of the input variables is entered during the execution of the program Dim x,y,v,c,N as single x=textbox1.text y=textbox2.text v=textbox3.text c=textbox4.text N= (x*x + y*y)/ (v*v * c*c) textbox5.text=N X y v c N Calculate
  • 98.
    Lecture 4 Discussion 3- Designa program that contain two button and two labels, when click the command show, the program shows a variable name “ last name” in the label 1 , and change the name variable “last name” to “Bodenstein von Karlstadt” and showes it in the label 2 at the same time as shown in the figure below.  Double-click the show button And we write the following code Dim LastName As String LastName = "Luther" Label1.Text = LastName LastName = "Bodenstein von Karlstadt" Label2.Text = LastName End Sub  Double-click the quit button And we write the following code End End Sub 4- Design a program that contain two button and one labels, when click the command “input box”, the program shows input box asked you to enter
  • 99.
    your name ,when you enter your name and click ok , your name shows in the label as shown in the figure below.  Double-click the input box button And we write the following code Dim Prompt, FullName As String Prompt = "Please enter your name." FullName = InputBox(Prompt) Label1.Text = FullName End Sub  Double-click the quit button And we write the following code End End Sub
  • 100.
    Lecture 6 Discussion 3- Designa program for a school to calculate students course1 average, course2 average , midterm average and the final state as shown in the figure below Code generation Double click the ‫"احسب‬‫بلفصل‬ ‫الخاص‬"‫االول‬ and write the following code
  • 101.
    Double click the‫الخانات‬ ‫"تفريغ‬"‫االول‬ ‫بلفصل‬ ‫الخاص‬ and write the following code Double click the ‫"احسب‬"‫السنة‬ ‫بنصف‬ ‫الخاص‬ and write the following code
  • 102.
    Double click thebutton ON and write the following code Double click the button OFF and write the following code
  • 103.
    4- Design anillusion chat program, when write in the textbox1 and click send, the respond of the second person appears in the textbox2 at the same time as shown in the figure bellow. In this question, we use two textbox and one button, change the properties of textbox multiline to true and arrange the form as shown above  Double-click the button send. And we write the following code
  • 104.
    Lecture 7 Discussion 4- Designa dictionary program that translate from English to Arabic and vise verse , use your imagination to control the design as you want it to be We design the form as shown below, by add two textbox, one list box and one label  We Double-click the form. And write the following code Listbox1.items. add (“summer”) Listbox1.items. add (“wrong”) Listbox1.items. add (“communication”) Listbox1.items. add (“satellite”) Listbox1.items. add (“mother”) Listbox1.items. add (“faith”) Listbox1.items. add (“cheat”) Listbox1.items. add (“latitude”)
  • 105.
    Listbox1.items. add (“longitude”) Listbox1.items.add (“nurse”) Listbox1.items. add (“designer”) Listbox1.items. add (“book”) Listbox1.items. add (“pole”) Listbox1.sorted= true  We Double-click the search button. And write the following code If textbox1.text= “summer” then Textbox2.text= “ ‫الصيف‬ " Else if textbox1.text= “wrong” then Textbox2.text= “ ‫خطا‬ " Else if textbox1.text= “communication” then Textbox2.text= “ ‫اتصاالت‬ " Else if textbox1.text= “satellite” then Textbox2.text= “ ‫صناعي‬ ‫قمر‬ " Else if textbox1.text= “mother” then Textbox2.text= “ ‫ام‬-‫والدة‬ " Else if textbox1.text= “faith” then Textbox2.text= “ ‫ايمان‬-‫قدر‬ " Else if textbox1.text= “cheat” then Textbox2.text= “ ‫يغش‬-‫يتحايل‬ " Else if textbox1.text= “latitude” then Textbox2.text= “ ‫العرض‬ ‫خطوط‬ " Else if textbox1.text= “longitude” then Textbox2.text= “ ‫الطول‬ ‫خطوط‬ " Else if textbox1.text= “nurse” then Textbox2.text= “ ‫ممرضة‬-‫طبيب‬ ‫مساعدة‬ " Else if textbox1.text= “designer” then
  • 106.
    Textbox2.text= “ ‫مصمم‬" Else if textbox1.text= “book” then Textbox2.text= “ ‫كتاب‬ " Else if textbox1.text= “pole” then Textbox2.text= “ ‫قطب‬ " 5- What is the steps of connecting a vb.net to access?  First of all we Open the access and create a simple table  We Save the program in documents and named it Yousef  We Open vb.net and open a new project  We Choose “ add new data source” from project  We choose database and click next  Again We choose database and click next  New connection / browse/ and then we choose Yousef database that we created/ ok/next  We save the connection by clicking on yes, save the connection as and click next  We Select all icons from choose your database objects and click finish  We drag the table to the form, the table will show up on the form 6- Design professional calculator by using vb.net?
  • 107.
     We Double-clickthe 0 button. And write the following code Textbox1.text= textbox1.text + “0”  We Double-click the 1 button. And write the following code Textbox1.text= textbox1.text + “1”  We Double-click the 2 button. And write the following code Textbox1.text= textbox1.text + “2”  We Double-click the 3 button. And write the following code Textbox1.text= textbox1.text + “3”  We Double-click the 4 button. And write the following code Textbox1.text= textbox1.text + “4”  We Double-click the 5 button. And write the following code Textbox1.text= textbox1.text + “5”  We Double-click the 6 button. And write the following code Textbox1.text= textbox1.text + “6”
  • 108.
     We Double-clickthe 7 button. And write the following code Textbox1.text= textbox1.text + “7”  We Double-click the 8 button. And write the following code Textbox1.text= textbox1.text + “8”  We Double-click the 9 button. And write the following code Textbox1.text= textbox1.text + “9”  We Double-click the. button. And write the following code Textbox1.text= textbox1.text + “.”  We Double-click the c button. And write the following code  We Double-click the form. And write the following code Public n1,n2 as double Dim st as string  We Double-click the + button. And write the following code  We Double-click the * button. And write the following code  We Double-click the - button. And write the following code
  • 109.
     We Double-clickthe / button. And write the following code  We Double-click the = button. And write the following code If st= “𝑥∧ ” then Textbox1.text= 𝑛1∧𝑛2  We Double-click the 1/x button. And write the following code  We Double-click the − + button. And write the following code  We Double-click the √ button. And write the following code
  • 110.
     We Double-clickthe 𝑥∧ button. And write the following code n1=val (textbox1.text) St=”𝑥∧ “ Textbox1. Clear ()