Presentation is loading. Please wait.

Presentation is loading. Please wait.

Special topics CPIT 490. Open visual basic net and choose create project for new project.

Similar presentations


Presentation on theme: "Special topics CPIT 490. Open visual basic net and choose create project for new project."— Presentation transcript:

1 Special topics CPIT 490

2 Open visual basic net and choose create project for new project

3 Chose windows application and write down name for project and path as location

4 Windows Application. Form حیث أن الرقم 1 يشیر إلى الفورم ( الرقم 2 properties ( الرقم 3) وله العديد من الخصائص Tools(.

5 ToolBox الرقم 1 يشیر إلى صندوق الأدوات حیث ستظھر لك قائمة بعشرات الأدوات المختلفة أو ماتسمى ب ( عناصر التحكم ) ،

6 introduction to data base

7 DATABASE CONNECTION ( MANUALY )

8 DECLARATIONS of data base in run time

9 Connecting data base with VB form using connection string

10 DATA BASE NAVIGATION

11 SEARCH THE DATA BASE BY FIRST NAME

12 DATABASE CONNECTION ( using wizard)

13

14 Dealing with data base records Navigation

15 Dealing with data base records

16

17 Create data base using MS access

18 Create table fields

19 Create table using design

20 Save table name

21 Choosing fields data types

22 Complete choosing all fields data types

23 Filling data in table ( records)

24 Design the following form with all needed labels, buttons, text boxes, and picture box

25 Add unavailable extra component to tool bar by right click on tool area and from property drop list select choose items

26 Then choose com components tab and check windows media player, then windows media player component will be added to tools list as shown below

27 Add windows media player to the form and change the name to WMP1 from properties

28 Data grid view is designed for showing all table records

29 For connecting the form with the data base( access) binding source is designed

30 بالنسبة لقائمة الأدوات فھي تختفي بمجرد إزالة الفأرة من علیھا، ولإعادتھا بإمكانك الضغط على الزر رقم 1 مرة أخرى أو الضغط على الزر رقم 3 الموضح في الرسم أعلاه فكلاھما سواسیة. والذي يحتوي على عشرات الخصائصالمتعلقة بكل أداة. Properties الرقم 2 يشیر إلى مربع الخصائص وأكثر مايھمنا من الخصائص ھما ھو اسم الأداة الذي يتم التعامل معه داخل البرنامج ( سیتضح لاحقا Name حیث أن Text و (Name) فھو النص المكتوب على الأداة والذي سیتم عرضه في التنفیذ. Text بشكل أكبر ) أما

31 مقدمة بيسك. نت INTRODUCTION TO BASIC.NET

32

33

34

35 Variables متغيرات (False) خاطئة (True), يستخدم لتمثیل القیمتین : صحیحة Boolean -  ( December الى 31, 9999 January يمثل التاريخ والوقت ( يمثل التاريخ من 1, 0001 Date -  يمثل عدد بین 0 و 255 ( قیم موجبة فقط ) Byte -  (-byte يمثل الأرقام العشرية ( 16 Decimal -  (-byte يمثل عدد صحیح ( 4 Integer -  (-byte يمثل عدد صحیح ( 8 Long -  (-byte يمثل عدد صحیح ( 2 Short -  يمثل عدد غیر صحیح بخانة واحدة بعد الفاصلة. Single -  يمثل عدد غیر صحیح. Double -  يمثل حرف واحد فقط. Char -  يمثل قیمة حرفیة تتسع الى 2 بلیون حرف. String - 

36 Declaring variables, constants, and arrays. General form for declaring variables: Dim MyVar As Type Declaring constant : Const name As data type = value Declaring array: Dim Array (number) As Data Type

37 BASIC MATHEMATICAL OPERATIONS

38 + علامة الجمع. - علامة الطرح. * علامة الضرب. / علامة القسمة.. ويمكن أن يكون الناتج عددا صحیحا أو به أرقام عشريّة.. فمثلا : X = 7 / 2. ستعطي الناتج 3.5 \ علامة القسمة أيضا، ولكنّ الناتج ھو العدد الصحیح فقط.. فمثلا : X = 7 \ 2. ستعطي الناتج 3 لو شئت ألا ترتبك بین علامتي القسمة ، Int ويمكن أداء نفسالعملیّة باستخدام الدالة المتشابھتین، وذلك كالتالي : X = Int (7/2) إحدى علامات القسمة أيضا، ولكنّھا تعطي الباقي من القسمة فحسب.. فمثلا : Mod X = 7 Mod 2 سیعطي الناتج 1 ، الذي ھو عبارة عن باقي القسمة. 2 تُكتب رياضیّا بالصیغة 3 2 ، وتكتب في البرمجة كالتالي : × 2 × ^ الأسّ.. فمثلا 2 2 ^ 3 ويجب أن ألفت انتباھك إلى أھمّیّة وضع الأقواس في العملیّات المتداخلة، وذلك حتّى تضمن صحّة إجراء العملیّة بالترتیب الذي تريدھا به. حیث : -1 يتمّ تنفیذ ما بین الأقواس أولا. -2 إذا لم تكن ھناك أقواس يتمّ تنفیذ الأسسأولا. -3 ثمّ يتمّ تنفیذ الضرب والقسمة. -4 ثمّ بعد ذلك يتمّ تنفیذ الجمع والطرح.

39 Message box - MSGBOX MsgBox ( " This is Visual Basic.Net Course") Or use it with msgbox style msgbox( " I am about to do something", MsgBoxStyle.OKCancel ) msgbox( " Are You Ahmed? ", MsgBoxStyle.YesNo ) The general form of msgbox is: Msgbox(“title”,”prompt”, msgstyle)

40 INPUT BOX General form of inputbox : Inputbox (“ prompt”, “inputbox title”) Example: InputBox( " What is Your Name ? ", " Student Name " )

41 IF STATEMENT There are three kinds of if statements: 1. Simple if then: IF ( CONDITION ) THEN STSTEMENT ENDIF 2. If else: IF ( CONDITION) THEN STSTEMENT1 ELSE STATEMENT2 ENDIF 3. Nested If : IF ( CONDITION) THEN STSTEMENT1 ELSE IF (CONDITION2) THEN STATEMENT2 ELSE IF (CONDITION3) THEN STATEMENT3 ENDIF

42 IF STATEMENT cont.

43 If else if ( nested if)

44 Select statement General form of select statement: Select case (condition) Case 0 Statement1 Case 1 Statement2 Case 3 Statement4 Case else Statement5 End case

45 جمل الدوران Loops جملة تستخدم لتكرار آتلة من البيانات (1) For ……. Next ملاحظة : يكون استخدام هذه الجملة عندما تكون تعرف بداية ونهاية الدوران أي تعرف متى يبدأ ومتى ينتهي الدوران * أساس جمل الدوران هو العداد * الهدف من العداد : أن يقوم بعد مرات الدوران.

46 For loop General form of for loop: For initial=val TO stopval STEP increment val Statement NEXT Example: For i= 0 to 10 step1 Msgbox(i) Next i

47 Example for and input box

48 CREATE NEW OBJECT AT RUN TIME

49 DIALOGS ( color, font) btn_colorname: cd1.ShowDialog() txt_name.BackColor = cd1.Color btn_picform: fd1.ShowColor = True fd1.ShowDialog() txt_name.Font = fd1.Font txt_name.ForeColor = fd1.Color txt_name.BackColor = Color.LightGray

50 DIALOGS ( video)

51 DIALOGS ( sound - audio)

52 DIALOGS ( pictures) ofd2.Filter = "jpg(*.jpg)|*.jpg|all files(*.*)|*.*" ofd2.InitialDirectory = "c\" ofd2.FileName = "nan name" ofd2.ShowDialog() PictureBox1.Image = System.Drawing.Image.FromFile(ofd2.FileName)

53 LIST BOX & COMBO BOX  List box is an object which represents an array of text.  Each item has unique index.  Combo box is the most similar component to list box with one item shown.  List box could be filled during design and run time.  Design time fill: property  items  collection  text.  Run time fill: by using ( listbox1.items.insert( ), or listbox1.items.add( ) )

54 Design the following form with buttons and list box as shown

55 List box operations and codes '1- add AAA FIRST: ListBox1.Items.Insert(0, "AAA") '2- add AAA LAST: ListBox1.Items.Insert(ListBox1.Items.Count, "AAA") '3- add AAA midle: ListBox1.Items.Insert(ListBox1.Items.Count / 2, "AAA") '4- add AAA 2nd position: ListBox1.Items.Insert(1, "AAA") '5- add specific name first: Dim s As String s = InputBox(" enter the name") ListBox1.Items.Insert(0, s) '6- add specific name last: Dim s As String s = InputBox(" enter the name") ListBox1.Items.Insert(ListBox1.Items.Count, s)

56 List box operations and codes '7- add specific name midle: Dim s As String s = InputBox(" enter the name") ListBox1.Items.Insert(ListBox1.Items.Coun t / 2, s) '8- add specific name 4th position: Dim s As String s = InputBox(" enter the name") ListBox1.Items.Insert(3, s) '9- add AAA in specific location by user: Dim x As Integer x = InputBox(" enter location") ListBox1.Items.Insert(x, "AAA") '10- add specific name in specific location by user: Dim s As String s = InputBox(" enter the name") Dim x As Integer x = InputBox(" enter location") ListBox1.Items.Insert(x, s)

57 List box operations and codes '11- delete first: ListBox1.Items.RemoveAt(0) '12- delete last: ListBox1.Items.RemoveAt(ListBox1.Items.Count - 1) '13- delete middle: ListBox1.Items.RemoveAt((ListBox1.Items.Count - 1) / 2) '14- delete 3rd position: ListBox1.Items.RemoveAt(2) '15- delete bu specific location: Dim x As Integer x = InputBox(" enter position to delete ") ListBox1.Items.RemoveAt(x)

58 List box operations and codes '16- delete be selection: ListBox1.Items.Remove(ListBox1.SelectedI tem) '17- clear items: ListBox1.Items.Clear() '18- is empty: If ListBox1.Items.Count = 0 Then MsgBox("empty list") Else MsgBox(" NOT Empty list") End If '19- search by name: Dim i As Integer Dim s As String s = InputBox(" enter name to find") Dim x As Integer For i = 0 To ListBox1.Items.Count - 1 Step 1 If ListBox1.Items.Item(i) = s Then MsgBox(" found") End If Next '20- count list elements: MsgBox(ListBox1.Items.Count)

59 Image processing

60 Image processing showing picture as matrix of colored pixels

61 Image processing - showing picture as matrix of RGB

62 Image processing showing picture as gray scale

63 Image processing showing picture as binary (B/W)

64 STRING FUNCTIONS

65 STRING FUNCTIONS cont.

66

67

68

69

70

71

72

73 STRING and 2D array

74 GPS

75

76 TIMER TIMER: HAS THREE IMPORTANT PROPERTIES WHICH ARE (NAME, INTERVAL, AND ENABLED). THE TIMER WILL RUN THE CODE IN ITS SUB EVERY INTERVAL PERIOD THAT IS IN MILLISECONDS. RANDOM NUMBER BETWEEN A AND B, WHERE A IS THE HIGHER BOUNDARY, AND B IS THE LOWER BOUNDARY WITH IS ( B + INT ( RAND ( ) * A – B). FOR MOVING ELEMENTS, THE LEFT AND TOP PROPERTIES ARE USED, WHILE THE HEIGHT AND WIDTH PROPERTIES USED FOR CHANGING THE SIZE.

77 ANIMATION

78 ANIMATION CODE LEFT: PIC1.Left = PIC1.Left - 10 RIGHT: PIC1.Left = PIC1.Left + 10 UP: PIC1.Top = PIC1.Top - 10 DOWN: PIC1.Top = PIC1.Top + 10 CORNER: PIC1.Left = PIC1.Top = 0 CENTER: PIC1.Top = Me.Height / 2 - PIC1.Height / 2 PIC1.Left = Me.Width / 2 - PIC1.Width / 2

79 ANIMATION CODE larg: PIC1.Height = PIC1.Height + 10 PIC1.Width = PIC1.Width + 10 small: PIC1.Height = PIC1.Height - 10 PIC1.Width = PIC1.Width - 10 shorter: PIC1.Height = PIC1.Height - 10 tall: PIC1.Height = PIC1.Height + 10 wid: PIC1.Width = PIC1.Width + 10 slim: PIC1.Width = PIC1.Width - 10

80 Create new project from vb.net Then chose the programming language ( visual basic, c#, asp, J#), which is visual basic. Then chose project type( web, windows application, smart device), which is smart device. Then chose the device type ( pocket pc, smart phone, windows),which is windows. Then chose the environment (device application ), As shown in figure

81 The form will appears as shown in the following figure, which is the same as normal windows application you used to work with, with almost all components (tools ).

82 Then we will write the code for each button as shown in the figure below.

83 For programming smart phone, we will design the form and after that will write the code for each component as follows. We will design two buttons for changing the background of the smart device, as shown below.

84 After that we will run the program by choosing bone of the emulators that suitable for or device( simulator) as shown in the following figure.

85 SMART DEVICE After running the program windows simulate the smart device will appears and allow user to deal with it. For installing the application in smart device, connect the device with the computer And save the application in the smart device The application will auto matic ly save in programs file and will started when you run it from the device.

86 GAME

87 ROBOT


Download ppt "Special topics CPIT 490. Open visual basic net and choose create project for new project."

Similar presentations


Ads by Google