1.الدوال Function 2.الاجراءاتSub Procedure 3.وحده نمطيه Add Module

Slides:



Advertisements
Similar presentations
Midterm 26 March 2015 (4:30-5:30 pm) – Rm5620 Closed book exam MC Questions only x25 Up to L(7) Methods Scope: video lectures (+Lab), forum discussions,
Advertisements

Practical Programming COMP153-08S Lecture: Repetition Continued.
Compunet Corporation Programming with Visual Studio.NET GUI Week 13 Tariq Aziz and Kevin Jones.
Introduction to Data Adapter. A Simplified View of ADO.Net Objects Ado.Net Data Provider Connection Adapter Command Reader Dataset Data Consumer WinForm.
Multiple Forms & Procedures. Form Methods: –Show, Hide, Activate, Close Events: –Load, Activated, Closing, Closed.
VB.NET Database Tools ISYS 573. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
Coding ADO.NET Objects: Connection, Command, DataReader.
Visual Basic 2008 Express Edition The IDE. Visual Basic 2008 Express The Start Page Recent Projects Open an existing project Create a New Project.
Directory and File. Access Files in a Directory Name space: System.IO The Directory and File classes contain only shared methods that set or return information.
CS0004: Introduction to Programming Variables – Numbers.
Plus Series DLL Introduction. DLL Compare for Plus Series DLL Item EZ2000.dllEZWeb.dll (for.Net) OS supportWindow 98 or latest (32bits) Windows 98 or.
1 Visual Basic for Applications (VBA) for Excel Prof. Yitzchak Rosenthal.
Visual Basic I Programming
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
1 Κατανεμημένες Διαδικτυακές Εφαρμογές Πολυμέσων Γιάννης Πετράκης.
Lecture 8 Visual Basic (2).
COMPUTER PROGRAMMING I Objective 7.03 Apply Built-in Math Class Functions.
1/31 5/6/2014 BAZELE PROGRMARII PE OBIECTE PROIECTE IN VISUAL BASIC Conf univ dr Botezatu Cezar INFORMATICĂ MANAGERIALĂ Anul I. STUDII DE LICENŢĂ.
1 CC111 Lec9 : Visual Basic Visual Basic (3) Lecture 9.
VB Procedures. Procedures. Sub procedure: Private/Public Sub SubName(Arguments) … End Sub Private: Can only be accessed by procedures in the same form.
COMPUTER PROGRAMMING I SUMMER Apply operators and Boolean expressions.
使用 SQL 指令執行報表 不需設定 Crystal Report 連線.
Visual Basic.NET Windows Forms Hello World Homework Assignment.
CS0004: Introduction to Programming Project 1 – Lessons Learned.
ADO.NET Objects – Data Providers Dr. Ron Eaglin. Requirements Visual Studio 2005 Microsoft SQL Server 2000 or 2005 –Adventure Works Database Installed.
Module 3: Using Microsoft.NET- Based Languages. Overview Overview of the.NET-Based Languages Comparison of the.NET-Based Languages.
6c – Function Procedures Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
PRACTICE SAC 1 Some solutions. 'inputs 'sale price 'postcode 'coupon codes 'processing 'calculate commissions (commission based on cost) 'calculate postage.
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
CIVIL AND GEOMATIC ENGINEERING FT Okyere. CIV 257- COMPUTER PROGRAMMING Lecture 3.
6b – Sub Procedure With Parameters Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
Using ADO.Net to Build a Login System Dr. Ron Eaglin.
1 Microsoft® Visual Basic®.NET Language # 2. 2 Flow-Control Statements If … End If Select Case … End Select For… Next Do … Loop Exit.
Lab 10 Slides.
ADO.NET Objects Data Adapters Dr. Ron Eaglin. Agenda Builds on Information in Part I Should have working knowledge of creating a database connection Continuation.
一次玩 5 個遊戲 題目 : 一次玩 5 個遊戲南台科技大學機械工程系奈米一乙蔡宗霖. 題目說明 : 主題說明與背景 遊戲名稱為 Web page games ,為五合一的遊 戲,由五個網頁遊戲組成,想玩網頁遊戲 又不想開網頁嗎? 遊戲名稱為 Web page games ,為五合一的遊 戲,由五個網頁遊戲組成,想玩網頁遊戲.
計算機程式及實習及期末報告 題目 : 長榮公司 南臺科技大學 機械工程系 班級 : 奈米一乙 學號 :4A 姓名 : 陳紀舜 授課教師 : 謝慶存.
Introduction to VB programming Dr. John P. Abraham UTPA Chapters 2 & 3.
MIC305 Week 6 Beyond controls Review of properties Differences with VB6: using classes and instances Programming constructs.
Addison Wesley is an imprint of © 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Chapter 3 Variables and Calculations.
T HE W ALKING FOR W ATER P ROJECT IE 2060 Katelyn Cockrell Alexis Duran Theresa Garcia.
These materials where developed by Martin Schray. Please feel free to use and modify them for non-commercial purposes. If you find them useful or would.
Visual Basic Declaring Variables Dim x as Integer = 0 In the statement above, x is being declared as an Integer (whole number) and is initialised.
Computer Science Up Down Controls, Decisions and Random Numbers.
Directory and File. Access Files in a Directory Name space: System.IO The Directory and File classes contain only shared methods that set or return information.
Data Types. Visual Basic provides data type Single for storing single-precision floating-point numbers. Data type Double requires more memory to store.
Introduction to Programming Lecture 3 Msury Mahunnah, Department of Informatics, Tallinn University of Technology.
Use TryParse to Validate User Input
UNIT 5 Lesson 15 Looping.
Objective 7.03 Apply Built-in Math Class Functions
Data Types, Arithmetic Operations
GUI Programming using Windows Form
Use TryParse to Validate User Input
Visual Basic 2010 Winsock이용
Introduction to VB programming
Files and Streams.
TreeView Control.
للمزيد زورونا على موقعنا الإلكتروني:
1.الدوال Function 2.الاجراءاتSub Procedure 3.وحده نمطيه Add Module
Boolean Expressions and If statements
購物範例.
Coding ADO.NET Objects: Connection, Command, DataReader
ASP.NET Relationships between tables
Database Handling Class and Service
CIS 338: Images on Forms Dr. Ralph D. Westfall May, 2009.
Files and Streams.
Setting Properties of Objects
GUI Programming in Visual Studio .NET
Web Service.
Sub 範例 Sub F ( X ) MsgBox(X ^ 2 ) End Function
Presentation transcript:

1.الدوال Function 2.الاجراءاتSub Procedure 3.وحده نمطيه Add Module

ما هي الدوال Function ؟ 1 - ما هي ال Function ؟ ال Function هو تجميع لعدة أكواد تحت مسمى واحد و يمكن إضافة متغيرات أثناء نداء هذه ال Function و توضع ال Function في مكان General مكان التصريحات ولابد أن تعود بقيمة مثال لدالة بدون متغيرات ... شروط اختياراسم الإجراء الفرعي:  لا يبدأ الاسم بأرقام.  لا يحتوي علي مسافات أو علامات خاصة.  يمكن أن يحتوي علي علامة Underscore _ لا يمكن أن يكون الاسم عبارة عن كلمة محجوزة

الشكل العام لكتابه الدالة هذه Function تم تجميع فيها الكود و يمكن نداءها داخل زر الحدث (button) الشكل العام لكتابه الدالة : Function FunctionName(arguments) 'الأوامر المراد تنفيذها Return value End Function هنا لابد ان ترجع قيمه للدالة

فائدتها 2 - ما فائدتها ؟ تفيد في إمكانية تجميع وتنظيم عدة أكواد لاحظت أنك ستستعملها مرارا ، فيمكنك مناداتها كلها بكلمة واحدة فقط ملاحظة : هناك بعض الكلمات المحجوزة التي لا يمكن وضعها كاسم لل Function مثلا close ,sub,dim

الإجراءات Sub Procedure هي عبارة عن برنامج فرعي نقوم بتخزين فيه بعض الأوامر المراد تنفيذها عن النداء عليه ولا يعود بأي قيم. شروط اختيار اسم الإجراء الفرعي:  لا يبدأ الاسم بأرقام.  لا يحتوي علي مسافات أو علامات خاصة.  يمكن أن يحتوي علي علامة Underscore _ لا يمكن أن يكون الاسم عبارة عن كلمة محجوزة

الإجراءات شرح Sub Procedure او sub والتي تستخدم في اختصار كود معين واستدعائه بطريقة  سهله Public Class Form1     Sub Givemessage()           MessageBox.Show("I am coll for using Subs")     End Sub       Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click         Call Givemessage()     End Sub هنا تم استدعاء الاجراء

مثال(حساب المتوسط الحسابي لثلاثة أعداد): هذا الإجراء يقوم بحساب المتوسط الحسابي لثلاثة ولن يتم تنفيذ هذا الإجراء الي أن نقوم بالنداء عليه (استدعائه).     Sub  calculateAVG (intX As Integer, inty As Integer, intZ As Integer) Dim Result As Double Result = (intX + inty + intZ) / 3 MsgBox (Result) End Sub

تشغيل الإجراء: يتم تشغيل الإجراء بمجرد ذكر اسم الإجراء وتمرير قيم المعاملات الخاصة به له كما هو موضح بالكود التالي:     Private Sub button_Click() calculateAVG (10, 20, 30) End Sub

3.وحده نمطيه add module عند تعريفك الاجراء sub اول داله Function في نموذج form واحد تستطيع استخدامها في انحاء البرنامج عن طريق وحده النمطية اضيفي module على المشروع واعملي التالي : باستخدام إجراء sub اعملي التالي : رساله " تشغيل " باسم (running) رساله "ايقاف " باسم (off)

يتم استدعاء من الميودل أي فورم في نفس المشروع Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.Text = 1 Then Call running() ‘تم استدعا داله من الميودل ElseIf TextBox1.Text = 0 Then Call off() ‘تم استدعا داله من الميودل End If End Sub

Form2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If TextBox1.Text = 1 Then Call running() ‘تم استدعا داله من الميودل ElseIf TextBox1.Text = 0 Then Call off() ‘تم استدعا داله من الميودل End If End Sub