by modar saleh في التصوير التلفزيوني أحجام اللقطات .ppt
تدريبات من خلال ميكروسوفت فى البرمجة كان من خلال توجية الحاسب الآلى
1. تدريبات من خلال ميكروسوفت فى البرمجة كان من خلال توجية الحاسب الآلى
الاساسية form للتعريف على المتغيرات الاساسية التى تدخل فى الثلاث Class يتم انشاء
بالزر الايمن وظهرت قائمة يتم الاختيار منها project ويتم انشاء التصنيف من خلال الضغط على
الاول Class ويكتب الكود كما يللى
Public Class usercheck
خلال من' class انشاء تم 1 Class باسم جديد userch للتعريف
Public Function check(ByVal a As String, ByVal b As String) As
Boolean
Dim str1, str2, str3, pw1, pw2, pw3 As String
str1 = "aaa"
pw1 = "111"
str2 = "bbb"
pw2 = "222"
str3 = "ccc"
pw3 = 333
If (a = str1 And b = pw1) Then
Return True
ElseIf (a = str2 And b = pw2) Then
Return True
ElseIf (a = str3 And b = pw3) Then
Return True
Else
Return False
End If
End Function
End Class
2. الاولى على النحو التالى Form ويتم انشاء
Form1
على هذا النحو التالى Enter باسم ويكتب كود مفتاح Button 1 عدد 1 label عدد 2 text تتكون من عدد 2
public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim c3 As New usercheck
Dim user As String = Me.TextBox1.Text
Dim password As String
password = Me.TextBox2.Text
Dim answer As Boolean = c3.check(user, password)
If (answer = True) Then
Dim enter As New Form2
Me.Visible = False
enter.Show()
End If
End Sub
End Class
Operation
User name
passward
Enter
3. calc ومن الممكن بدلا من 1 text نضع الكود على هذا النحو Public Class Form2
على هذا النحو التالى عدد 2 textbox1, وعدد 1 Label , وعدد 6 button
Form2
Calano Cala
operation
random
Sum
divided
0
واختيار العلامة رقم 4 وبالضغط عليها يتم properties والذهاب الى Form load ويتم الاختيار من الضغط على
وبالضغط فى المكان امامة ضغطتين متتاليتين ظهرت نافذة الكود form close اختييار
.FormClosed
Application.Exit()
End Sub
ملحوظة هامة جدا لاغلاق من غلق يتم الاغلاق التطبيق الحالى لكى يفتح تطبيق جديد اى كان
نكتب الكود التالى form وبالضغط على 2
Private Sub Form2_Load
Dim f1 As Form3 = New Form3
f1.ShowDialog()
End Sub
End Class
على هذا النحو calc ويكتب كود المفتاح الاول
4. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
TextBox1.Visible = True
TextBox2.Visible = True
Button2.Visible = True
Label1.Visible = True
عمل حالة فى الكود تكتب' groupbox1 , panl كتالى 1
Me.GroupBox1.Visible = True
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Me.GroupBox1.Visible = True
End Sub
على النحو التالى calc no كود المفتاح الثانى
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Me.Button1.Enabled = False
Dim c1 As cala = New cala
Dim m3 As Integer
Try
If (Me.TextBox1.Text = "" Or Me.TextBox2.Text = "") Then
MessageBox.Show(" input twono.first", "error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
m3 = c1.calctwono(Integer.Parse(TextBox1.Text),
Integer.Parse(TextBox2.Text))
Me.Label1.Visible = True
Me.Label1.Text = "n1+n2=" + m3.ToString()
Dim answer As DialogResult
5. answer = MessageBox.Show("do you want try againe?",
"twono", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If (answer = Windows.Forms.DialogResult.Yes) Then
clearall()
End If
End If
Catch ex As Exception
MsgBox(" ("المدخلات من تاكد
End Try
End Sub
Public Sub clearall()
Me.TextBox1.Clear()
Me.TextBox2.Clear()
Me.Label1.ResetText()
End Sub
الثالثة على النحو التالى Form ويتم انشاء
ونكتب الكود على هذا النحو Button 1 تتكون من عدد 1
Form 3
Form3 Private Sub Button1
MsgBox("welcome")
End Sub
End Class
اليوم الثالث الاربعاء
وتيم كتابة الكود على هذا النحو clac الثانى جديد باسم Class تيم انشاء
Public Class clac
Button 1
6. Public Function calc1(ByVal N1 As Integer, ByVal N2 As Integer)
As Integer
Dim n3 As Integer
n3 = N1 + N2
Return n3
End Function
End Class
ويتم كتابة الكود على هذا النحو operatortono. الثالث للتوريث باسم class ثم اضافة
Public Class operatortono
Inherits clac
Public Function clac(ByVal n1 As Integer, ByVal n2 As Integer) As
Integer
Dim n3 As Integer
n3 = n1 * n3
Return n3
End Function
End Class
Form يتم اضافة عدد 2 زر على 2
operation ويكتب الكود على هذا النحوالتالى فى مفتاح
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
Me.Button1.Enabled = False
Dim c2 As New operatortono
Dim m, n As Integer
Try
If (Me.TextBox1.Text = "" Or Me.TextBox2.Text = "") Then
MessageBox.Show(" input twono.first", "error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
operation
7. m = c2.operatetwono(Integer.Parse(TextBox1.Text),
Integer.Parse(TextBox2.Text))
n = c2.calctwono(Integer.Parse(TextBox1.Text),
Integer.Parse(TextBox2.Text))
MsgBox(c2.tryno())
Me.Label1.Visible = True
Me.Label1.Text = "n1*n2=" + m.ToString() + "," +
"n1+n2=" + n.ToString()
End If
Catch ex As Exception
MsgBox(" ("المدخلات من تاكد
End Try
End Sub
random
بمعنى عشوائى Random ويكتب الكود على هذا النحو التالى فى مفتاح
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
Dim c3 As New trydiffrentns.notsamenamespace
MsgBox(c3.tryno)
End Sub
يوم الخميس تم اضافة calss الرابعة باسم
ء انشا يت' Class باسم جديد notsamenamespace للعمل
الدوال
Namespace trydiffrentns
Public Class notsamenamespace
Public Function tryno() As Double
Dim r1 As New Random
Dim n1 As Double
8. n1 = r1.Next(0, 100)
Return n1
End Function
End Class
End Namespace
الثانية calc ويتم اضافة على
Public Class cala
الجمع بالعمليات خاص التصنيف '
Inherits trydiffrentns.notsamenamespace
Public Function calctwono(ByVal n1 As Integer, ByVal n2 As
Integer) As Integer
Dim n3 As Integer
n3 = n1 + n2
Return n3
End Function
End Class
على النحو التالى calss اليوم الرابع الخميس ثم اضافة عدد 3
'Public Class الادخال متغيرات بتعريف خاص الثانى التصنيف هو التصنيف هذا
قاعدة وتحقيق بها الخاصة الارقام وكتابة حروف عن عبارة if شرط وجود مع
باستخدام معين And
Public MustInherit Class class1
Public Function sumtwono(ByVal n1 As Integer, ByVal n2 As
Integer) As Integer
Dim n3 As Integer
n3 = n1 + n2
n3 = n3 + (n2 + n1)
9. Return n3
End Function
End Class
Public Class Class2
Inherits class1
من التوريث تيم' class التصنيف صفات من calc الجديدة الصفات باضافة
Public Function dividtwono(ByVal n1 As Integer, ByVal n2 As
Integer) As Integer
Dim n3 As Integer
If (n2 > 0) Then
n3 = n1 / n2
Else
n3 = 0
End If
Return n3
End Function
End Class
ثم اضافة عدد 2 مفتاح على النحو التالى Public Class Class3
Inherits cala
داخل من التوريث تم التصنيف هذا' class1
Public Function chossetwono() As Double
Dim n3 As Double
Dim r1, r2 As New Random
Dim n1, n2 As Double
n1 = r1.Next(0, 100)
n2 = r2.Next(0, 100)
Return n3
End Function
End Class
المفتاح الخامس ويكتب الكود على هذا النحو
Sum
10. Private Sub Button5_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button5.Click
Me.Button1.Enabled = False
Dim c2 As New Class2
Dim m, n As Integer
Try
If (Me.TextBox1.Text = "" Or Me.TextBox2.Text = "") Then
MessageBox.Show(" input twono.first", "error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
m = c2.dividtwono(Integer.Parse(TextBox1.Text),
Integer.Parse(TextBox2.Text))
n = c2.sumtwono(Integer.Parse(TextBox1.Text),
Integer.Parse(TextBox2.Text))
Me.Label1.Visible = True
Me.Label1.Text = "n1/n2=" + m.ToString() + "," + "n3
+ (n2 + n1)=" + n.ToString()
End If
Catch ex As Exception
MsgBox(" ("المدخلات من تاكد
End Try
End Sub
ويتم اضافة المفتاح السادس ويكتب الكود على النحو التالى
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button6.Click
Dim m, n, a As Double
Dim s2 As New Class3
divided
11. If (Me.TextBox1.Text = "" And Me.TextBox2.Text = "") Then
MessageBox.Show("inputtwono.first", "error",
MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
m = s2.calctwono(Integer.Parse(TextBox1.Text),
Integer.Parse(TextBox2.Text))
a = s2.tryno()
n = s2.chossetwono()
Me.Label1.Visible = True
Me.Label1.Text = "n1+n2=" + m.ToString() + "," + "n3=" +
n.ToString() + "," + " random n3 = " + a.ToString()
End If
End Sub
End Class
اليوم الخامس السبت
2 الكود والتعديل على النحو التالى Form يتم اضافة فى
Public Class Form2
Dim user As String
Public Sub New(ByVal a As String)
InitializeComponent()
user = a
النافذة على العناصر لوضع'
End Sub
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim f1 As New Form3
f1.ShowDialog()
Me.Text += " " + user
'MsgBox(user)
لاظهار' Form ويختفى يظهر مربع صورة فى 1
End Sub
ومن form يكون كود مفتاح 1 Enter على النحو التالى
12. Dim c3 As New usercheck
Dim user As String = Me.TextBox1.Text
Dim password As String
password = Me.TextBox2.Text
Dim answer As Boolean = c3.check(user, password)
If (answer = True) Then
Dim enter As New Form2(user) اضافة
Me.Visible = False
enter.Show()
End If
End Sub
End Class