You are on page 1of 42

‫ الفرقة الثالثة إنتاج‬- 2 ‫أكواد برامج مادة تطبيقات الحاسب اآللي‬

‫البرنامج األول‬

Option Explicit

Private Sub Cmdcalculate_Click()


Dim stname As String
Dim innumber As Byte
Dim sgbase As Single
Dim sgsales As Single
Dim sgpercent As Single
Dim sgp As Single
Dim sgtransp As Single
Dim sgsalary As Single
stname = txtname.Text:
sgbase = txtbase.Text
sgsales = txtsales.Text
sgpercent = Txtpercent.Text
sgtransp = Txttransp.Text
sgp = Txtp.Text
sgsalary = sgbase + (sgpercent / 100) * sgsales + sgtransp - sgp
txtsalary.Text = sgsalary
End Sub
Private Sub Cmdexit_Click()
End
End Sub

****----****----****
‫البرنامج الثاني‬

Private Sub Timer1_Timer()


Text1.Visible = False
Image1.Visible = True
Timer1.Enabled = False
End Sub
Private Sub Timer2_Timer()
Text2.Visible = False
Image2.Visible = True
Timer2.Enabled = False
End Sub
Private Sub Timer3_Timer()
Text3.Visible = False
Image3.Visible = True
Timer3.Enabled = False
End Sub
Private Sub Timer4_Timer()
Text1.Visible = True
Text2.Visible = True
Text3.Visible = True
Timer4.Enabled = False
End Sub

****----****----****
‫البرنامج الثالث‬

Option Explicit
Public inage As Byte
Private Sub Cmdclear_Click()
Cmdifthen1.Enabled = False: Cmdifthen2.Enabled = False
Cmdifthen3.Enabled = False: Cmdifthen4.Enabled = False
Cmdifthen5.Enabled = False
Cmdread.Enabled = True
txtnote.Text = "Note about the age will be here"
End Sub
Private Sub Cmdexit_Click()
End
End Sub
Private Sub Cmdgotom_Click()
Form2.Hide
End Sub
Private Sub Cmdifthen1_Click()
Rem the form of if <cond.> then <cmd.> in one line
If inage > 80 Then txtnote.Text = "You are too old-1a-"
If inage <= 80 Then txtnote.Text = "You are't too old-1b-"
End Sub
Private Sub Cmdifthen2_Click()
Rem form of if <cond.> then <cmds.> ....endif
If inage > 80 Then
Beep
txtnote.Text = "You are too old -2a-"
End If
If inage <= 80 Then
txtnote.Text = "You are't too old -2b-"
End If
End Sub
Private Sub Cmdifthen3_Click()
Rem form of if (cond.) then (cmds.)else (cmds)endif
If inage > 80 Then
txtnote.Text = "You are too old -3a-"
Else
txtnote.Text = "Your are't too old-3b-"
End If
End Sub
Private Sub Cmdifthen4_Click()
Rem form of if not(cond.)then (cmds.)"one line"
If Not inage = 80 Then txtnote.Text = "The age is't 80-4a-"
If inage = 80 Then txtnote.Text = "The age is 80-4b-": Beep
End Sub
Private Sub Cmdifthen5_Click()
Rem form of nested if not"in many lines"
If inage >= 15 Then
If inage > 35 Then
If inage >= 80 Then
txtnote.Text = "You are too old-5a"
Else
txtnote.Text = "Your age is suitable-5b"
End If
Else
txtnote.Text = "You are young-5c"
End If
Else
txtnote.Text = "You are a boy-5d"
End If
End Sub
Private Sub Cmdread_Click()
inage = txtage.Text
Cmdifthen1.Enabled = True: Cmdifthen2.Enabled = True
Cmdifthen3.Enabled = True: Cmdifthen4.Enabled = True
Cmdifthen5.Enabled = True
Cmdread.Enabled = False
End Sub

****----****----****
‫البرنامج الرابع‬

Option Explicit
Dim sgm As Single
Private Sub cmdrank_Click()
Select Case sgm
Case 0 To 39.5
txtrank.Text = "‫"ضعيف جدا‬
Case 40 To 59.5
txtrank.Text = "‫"ضعيف‬
Case 60 To 69.5
txtrank.Text = "‫"مقبول‬
Case 70 To 79.5
txtrank.Text = ‫" "جيد‬
Case 80 To 89.5
txtrank.Text = "‫"جيد جدا‬
Case 90 To 100
txtrank.Text = "‫"ممتاز‬
End Select
End Sub
Private Sub Cmdtest_Click()
Dim stg As String
If Len(txtmark.Text) > 0 Then
stg = Val(txtmark.Text)
If stg = txtmark.Text Then
sgm = txtmark.Text
If (sgm >= 0 And sgm <= 100) Then cmdrank.Enabled = True:
cmdtest.Enabled = False
If (sgm < 0 Or sgm > 100) Then txtmark.Text = ""
End If
If Not stg = txtmark.Text Then txtmark.Text = ""
End If
End Sub
Private Sub Command1_Click()
txtmark.Text = "": txtrank.Text = ""
cmdtest.Enabled = True: cmdrank.Enabled = False
End Sub
Private Sub Command2_Click()
End
End Sub

****----****----****
‫البرنامج الخامس‬

Dim L, X, N, p, qx, bm As Single


Private Sub calculate_Click()
L = HS1.Value
X = HS2.Value
N = HS3.Value
If X <= L Then
Rem ----- calculating Shear force
p = (N * (L / 100)) / 2
qx = p - N * (X / 100)
Text4.Text = qx
Rem ----- calculating Bending Moment
bm = p * (X / 100) - N * (X / 100) * (1 / 2) * (X / 100)
Text5.Text = bm
End If
If X > L Then MsgBox " X must be less than the length of the Beam"
End Sub
Private Sub Form_Load()
Text1.Text = HS1.Value
Text2.Text = HS2.Value
Text3.Text = HS3.Value
End Sub
Private Sub HS1_Change()
Text1.Text = HS1.Value
End Sub
Private Sub HS2_Change()
Text2.Text = HS2.Value
End Sub
Private Sub HS3_Change()
Text3.Text = HS3.Value
End Sub

****----****----****
‫البرنامج السادس‬

Option Explicit
Dim i As Byte
Dim L, X, N, p As Single
Dim qx, bm As Single
Dim xo, yo, xo2, yo2 As Single
Dim scx, scy, sc2y, sc3y As Single
Dim deltx As Single
Dim xact1 As Single
Dim shear(12) As Single
Dim bmm(12) As Single
Private Sub calculate_Click()
L = HS1.Value
X = HS2.Value
N = HS3.Value
Rem ----- calculating Shear force
p = (N * (L / 100)) / 2
qx = p - N * (X / 100)
Text4.Text = Round(qx, 3)
Rem ----- calculating Bending Moment
bm = p * (X / 100) - N * (1 / 2) * (X / 100) ^ 2
Text5.Text = Round(bm, 3)
Rem ---the following-Drawing S.F &Bending Moment
For i = 1 To 11
deltx = L / 10
xact1 = (i - 1) * deltx
Rem ----------shear force
shear(i) = p - N * (xact1 / 100)
Lsh(i).X1 = xo + scx * deltx * (i - 1)
Lsh(i).Y1 = yo
Lsh(i).X2 = xo + scx * deltx * (i - 1)
Lsh(i).Y2 = yo - sc2y * shear(i)
Rem ----------Binding Moment
bmm(i) = p * (xact1 / 100) - N * (1 / 2) * (xact1 / 100) ^ 2
Lbm(i).X1 = xo2 + scx * deltx * (i - 1)
Lbm(i).Y1 = yo2
Lbm(i).X2 = xo2 + scx * deltx * (i - 1)
Lbm(i).Y2 = yo2 - sc3y * bmm(i)
Print (i)
Next i
Rem ---the following - Drawing Beam of S.F
Lbeam.X1 = xo: Lbeam.Y1 = yo
Lbeam.X2 = xo + scx * L
Lbeam.Y2 = yo
Rem --the following -Drawing Beam of B.M
Lbeam2.X1 = xo2: Lbeam2.Y1 = yo2
Lbeam2.X2 = xo2 + scx * L
Lbeam2.Y2 = yo2
Rem ------------drawing closing lines
Lclose.X1 = Lsh(1).X1: Rem --- Line(1)
Lclose.Y1 = yo + sc2y * shear(11)
Lclose.X2 = Lsh(11).X2
Lclose.Y2 = Lsh(11).Y2
Lclose2.X1 = xo2: Rem --- Line(2)
Lclose2.Y1 = yo2
Lclose2.X2 = Lbm(6).X2
Lclose2.Y2 = Lbm(6).Y2
Lclose3.Y1 = yo2: Rem --- Line(3)
Lclose3.X1 = xo2 + scx * L
Lclose3.X2 = Lbm(6).X2
Lclose3.Y2 = Lbm(6).Y2
Rem ----------- the following - line of X
Lx.X1 = xo: Lx.Y1 = yo - 600
Lx.X2 = xo + scx * X
Lx.Y2 = yo - 600
Rem ---------ading labels
LabelX.Left = Lx.X2
LabelX.Top = yo - 600
LabelSF.Left = xo
LabelSF.Top = yo + 100
LabelBM.Left = xo2
LabelBM.Top = yo2 + 100
End Sub
Private Sub exit_Click()
End
End Sub
Private Sub Form_Load()
HS2.Max = HS1.Value
HS2.Value = 0.5 * HS2.Max
Text1.Text = HS1.Value
Text2.Text = HS2.Value
Text3.Text = HS3.Value
xo = 7000: yo = 2000
xo2 = 7000: yo2 = 5000
scx = 20: scy = 10: sc2y = 150: sc3y = 500
Rem --- the following for auto-work
calculate_Click
End Sub
Private Sub HS1_Change()
HS2.Max = HS1.Value
HS2.Value = 0.5 * HS2.Max
Text1.Text = HS1.Value
calculate_Click
End Sub
Private Sub HS2_Change()
Text2.Text = HS2.Value
calculate_Click
End Sub
Private Sub HS3_Change()
Text3.Text = HS3.Value
calculate_Click
End Sub
****----****----****
‫البرنامج السابع‬

Option Explicit
Dim xo, yo As Single
Dim de, ef, fd As Single
Dim x1, x2, y1 As Single
Dim p, p1, area1, area2 As Single
Dim v, t, d, w As Single
Private Sub calculate_Click()
Text1.Text = HS1.Value
Text2.Text = HS2.Value
Text3.Text = HS3.Value
Text4.Text = HS4.Value
Text5.Text = HS5.Value
Text6.Text = HS6.Value / 100
Rem Drawing Base of Traingle
Line3.x1 = xo
Line3.x2 = xo + HS2.Value
Line3.y1 = yo + Shape1.Width
Line3.Y2 = yo + Shape1.Width
Rem Drawing line EF
Line4.x1 = xo + HS2.Value
Line4.x2 = xo + HS3.Value
Line4.y1 = yo + Shape1.Width
Line4.Y2 = yo + Shape1.Width - HS4.Value
Rem Drawing line FD
Line5.x1 = xo
Line5.x2 = xo + HS3.Value
Line5.y1 = yo + Shape1.Width
Line5.Y2 = yo + Shape1.Width - HS4.Value
Rem ---------ading labels
T4.Text = "D(" & "0" & "," & "0" & ")"
T3.Text = "C(" & Shape1.Width & "," & "0" & ")"
T2.Text = "B(" & Shape1.Width & "," & Shape1.Height & ")"
T1.Text = "A(" & "0" & "," & Shape1.Height & ")"
T5.Text = "E(" & HS2.Value & "," & "0" & ")"
T6.Text = "F(" & HS3.Value & "," & HS4.Value & ")"
Rem ------ adjusting positions of labels
T1.Top = yo - 300
T2.Top = yo - 300
T4.Top = yo + 100 + Shape1.Height
T3.Top = yo + 100 + Shape1.Height
T5.Top = yo - 250 + Shape1.Height
T6.Top = yo - 100 + Shape1.Height - HS4.Value
T2.Left = xo + Shape1.Width
T3.Left = xo + Shape1.Width
T5.Left = xo + 100 + HS2.Value
T6.Left = xo + 100 + HS3.Value
Rem -- calculating lengths DE,EF and FD
x1 = HS2.Value / 1000
x2 = HS3.Value / 1000
y1 = HS4.Value / 1000
de = x1
Text7.Text = Round(de, 3)
ef = ((x1 - x2) ^ 2 + y1 ^ 2) ^ 0.5
Text8.Text = Round(ef, 3)
fd = (x2 ^ 2 + y1 ^ 2) ^ 0.5
Text9.Text = Round(fd, 3)
Rem ---- calculating perimeter & areas
p = de + ef + fd
Text10.Text = Round(p, 3)
area1 = (Shape1.Width / 1000) ^ 2
Text11.Text = Round(area1, 3)
p1 = p / 2
area2 = (p1 * (p1 - de) * (p1 - ef) * (p1 - fd)) ^ 0.5
Text12.Text = Round(area2, 3)
Rem ---- calculating Volume & weight of DEF
t = HS5.Value / 1000
v = area2 * t
Text13.Text = Round(v, 4)
d = HS6.Value / 1000
w=v*d
Text14.Text = Round(w, 4)
End Sub
Private Sub exit_Click()
End
End Sub
Private Sub Form_Load()
Shape1.Width = HS1.Value
Shape1.Height = HS1.Value
Text1.Text = HS1.Value
Text2.Text = HS2.Value
Text3.Text = HS3.Value
Text4.Text = HS4.Value
Text5.Text = HS5.Value
Text6.Text = HS6.Value / 100
xo = 7500: yo = 1000
Rem --- the following for auto-work
calculate_Click
End Sub
Private Sub HS1_Change()
Shape1.Width = HS1.Value
Shape1.Height = HS1.Value
HS2.Max = Shape1.Width
HS3.Max = Shape1.Width
HS4.Max = Shape1.Width
calculate_Click
End Sub
Private Sub HS2_Change()
calculate_Click
End Sub
Private Sub HS3_Change()
calculate_Click
End Sub
Private Sub HS4_Change()
calculate_Click
End Sub
Private Sub HS5_Change()
calculate_Click
End Sub
Private Sub HS6_Change()
calculate_Click
End Sub

****----****----****
‫البرنامج الثامن‬

Option Explicit
Option Base 1
Dim OO1, OO2, O1, O2, R2, L, ee, pii As Double
Dim xxa(360), yya(360), xxb(360), yyb(360), xxc(360), yyc(360) As
Double
Dim x0, y0, xa, ya, xb, yb, xc, yc, x1, x2 As Double
Dim i As Integer
Private Sub Command1_Click()
Text1.Text = HScroll1.Value: Text2.Text = HScroll2.Value: Text3.Text
= HScroll3.Value
Text4.Text = HScroll4.Value: Text5.Text = HScroll5.Value:
R2 = Text1.Text: L = Text2.Text: ee = Text3.Text: x0 = Text8.Text: y0 =
Text9.Text
OO1 = Text4.Text: OO2 = Text5.Text: pii = (22 / 7) / 180
O1 = OO1 * pii: O2 = OO2 * pii
x1 = R2 * Cos(O2 - O1)
x2 = (L ^ 2 - (R2 * Sin(O2 - O1) - ee) ^ 2) ^ 0.5
xa = x0 + R2 * Cos(O2 - O1): ya = y0 - R2 * Sin(O2 - O1)
xb = x0 + (x1 + x2) * Cos(O1) - ee * Sin(O1): yb = y0 - ((x1 + x2) *
Sin(O1) + ee * Cos(O1))
xc = x0 + 2 * (x1 + x2) * Cos(O1): yc = y0 - 2 * (x1 + x2) * Sin(O1)
Rem ---- draw first line
Line1.Visible = True
Line1.x1 = x0: Line1.Y1 = y0: Line1.x2 = xa: Line1.Y2 = ya
Rem ---- draw first line
Line2.Visible = True
Line2.x1 = xa: Line2.Y1 = ya: Line2.x2 = xb: Line2.Y2 = yb
Rem ---- draw second line
Line3.Visible = True
Line3.x1 = x0: Line3.Y1 = y0: Line3.x2 = xc: Line3.Y2 = yc
Rem ---- draw third line
Line4.Visible = True
Line4.x1 = x0: Line4.Y1 = y0 - ee: Line4.x2 = xc: Line4.Y2 = yc - ee
Rem ---- draw forth shap
Shape1.Visible = True: Shape1.Top = ya - 500: Shape1.Left = xa - 75
Text6.Text = x1: Text7.Text = x2
End Sub
Private Sub Command2_Click()
For i = 1 To 360
Text1.Text = HScroll1.Value: Text2.Text = HScroll2.Value: Text3.Text
= HScroll3.Value
Text4.Text = HScroll4.Value: Text5.Text = HScroll5.Value:
R2 = Text1.Text: L = Text2.Text: ee = Text3.Text: x0 = Text8.Text: y0 =
Text9.Text
OO1 = Text4.Text: OO2 = i: pii = (22 / 7) / 180
O1 = OO1 * pii: O2 = OO2 * pii
x1 = R2 * Cos(O2 - O1)
x2 = (L ^ 2 - (R2 * Sin(O2 - O1) - ee) ^ 2) ^ 0.5
xa = x0 + R2 * Cos(O2 - O1): ya = y0 - R2 * Sin(O2 - O1)
xb = x0 + (x1 + x2) * Cos(O1) - ee * Sin(O1): yb = y0 - ((x1 + x2) *
Sin(O1) + ee * Cos(O1))
xc = x0 + 2 * (x1 + x2) * Cos(O1): yc = y0 - 2 * (x1 + x2) * Sin(O1)
xxa(i) = xa: yya(i) = ya
xxb(i) = xb: yyb(i) = yb
xxc(i) = xc: yyc(i) = yc
Next i
i = 1: Timer1.Enabled = True
Command1.Enabled = False
End Sub
Private Sub Command3_Click()
End
End Sub
Private Sub HScroll1_Change()
Text1.Text = HScroll1.Value
End Sub
Private Sub HScroll2_Change()
Text2.Text = HScroll2.Value
End Sub
Private Sub HScroll3_Change()
Text3.Text = HScroll3.Value
End Sub
Private Sub HScroll4_Change()
Text4.Text = HScroll4.Value
End Sub
Private Sub HScroll5_Change()
Text5.Text = HScroll5.Value
End Sub
Private Sub HScroll6_Change()
Timer1.Interval = HScroll6.Value
Text10.Text = HScroll6.Value
End Sub
Private Sub Timer1_Timer()
Rem ---- draw first line
Line1.Visible = True
Line1.x1 = x0: Line1.Y1 = y0: Line1.x2 = xxa(i): Line1.Y2 = yya(i)
Rem ---- draw second line
Line2.Visible = True
Line2.x1 = xxa(i): Line2.Y1 = yya(i): Line2.x2 = xxb(i): Line2.Y2 =
yyb(i)
Rem ---- draw third line
Line3.Visible = True
Line3.x1 = x0: Line3.Y1 = y0: Line3.x2 = xc: Line3.Y2 = yc
Rem ---- draw forth line
Line4.Visible = True
Line4.x1 = x0: Line4.Y1 = y0 - ee: Line4.x2 = xc: Line4.Y2 = yc - ee
Rem ---- draw circle shap
Shape1.Visible = True: Shape1.Top = yya(i) - 500: Shape1.Left = xxa(i) - 75
If i < 360 Then i = i + 1: Timer1.Enabled = True
End Sub

****----****----****
‫البرنامج التاسع‬

Dim a(3, 3) As Single


Dim b(3, 3) As Single
Dim c(3, 3) As Single
Private Sub cmdarray1_Click()
Dim i As Integer
Dim j As Integer
For i = 1 To 3
For j = 1 To 3
c(i, j) = a(i, j) + b(i, j)
Next j
Next i
txtc11.Text = c(1, 1): txtc12.Text = c(1, 2)
txtc13.Text = c(1, 3): txtc21.Text = c(2, 1)
txtc22.Text = c(2, 2): txtc23.Text = c(2, 3)
txtc31.Text = c(3, 1): txtc32.Text = c(3, 2)
txtc33.Text = c(3, 3)
txtnote.Text = "Addition A+B"
End Sub
Private Sub cmdarray2_Click()
Dim i As Integer
Dim j As Integer
For i = 1 To 3
For j = 1 To 3
c(i, j) = a(i, j) - b(i, j)
Next j
Next i
txtc11.Text = c(1, 1): txtc12.Text = c(1, 2)
txtc13.Text = c(1, 3): txtc21.Text = c(2, 1)
txtc22.Text = c(2, 2): txtc23.Text = c(2, 3)
txtc31.Text = c(3, 1): txtc32.Text = c(3, 2)
txtc33.Text = c(3, 3)
txtnote.Text = " A-B"
End Sub
Private Sub cmdarray3_Click()
Dim i As Integer
Dim j As Integer
For i = 1 To 3
For j = 1 To 3
c(i, j) = b(i, j) - a(i, j)
Next j
Next i
txtc11.Text = c(1, 1): txtc12.Text = c(1, 2)
txtc13.Text = c(1, 3): txtc21.Text = c(2, 1)
txtc22.Text = c(2, 2): txtc23.Text = c(2, 3)
txtc31.Text = c(3, 1): txtc32.Text = c(3, 2)
txtc33.Text = c(3, 3)
txtnote.Text = " B-A"
End Sub
Private Sub cmdarray4_Click()
Dim i As Byte
Dim j As Byte
Dim k As Byte
Dim sgsum As Single
For i = 1 To 3
For j = 1 To 3
sgsum = 0
For k = 1 To 3
sgsum = sgsum + a(i, k) * b(k, j)
Next k
c(i, j) = sgsum
Next j
Next i
txtc11.Text = c(1, 1): txtc12.Text = c(1, 2)
txtc13.Text = c(1, 3): txtc21.Text = c(2, 1)
txtc22.Text = c(2, 2): txtc23.Text = c(2, 3)
txtc31.Text = c(3, 1): txtc32.Text = c(3, 2)
txtc33.Text = c(3, 3)
txtnote.Text = " A*B"
End Sub
Private Sub cmdarray5_Click()
Dim i As Byte
Dim j As Byte
Dim k As Byte
Dim sgsum As Single
For i = 1 To 3
For j = 1 To 3
sgsum = 0
For k = 1 To 3
sgsum = sgsum + b(i, k) * a(k, j)
Next k
c(i, j) = sgsum
Next j
Next i
txtc11.Text = c(1, 1): txtc12.Text = c(1, 2)
txtc13.Text = c(1, 3): txtc21.Text = c(2, 1)
txtc22.Text = c(2, 2): txtc23.Text = c(2, 3)
txtc31.Text = c(3, 1): txtc32.Text = c(3, 2)
txtc33.Text = c(3, 3)
txtnote.Text = " A*B"
End Sub
Private Sub cmdread_Click()
Rem read array A (a11,a12,a13-a21,a22,a23-a31,a32,a33)
a(1, 1) = txta11.Text:
a(1, 2) = txta12.Text
a(1, 3) = txta13.Text
a(2, 1) = txta21.Text
a(2, 2) = txta22.Text
a(2, 3) = txta23.Text
a(3, 1) = txta31.Text
a(3, 2) = txta32.Text
a(3, 3) = txta33.Text
Rem read array B (b11,b12,.....,b33)
b(1, 1) = txtb11.Text: b(1, 2) = txtb12.Text
b(1, 3) = txtb13.Text: b(2, 1) = txtb21.Text
b(2, 2) = txtb22.Text: b(2, 3) = txtb23.Text
b(3, 1) = txtb31.Text: b(3, 2) = txtb32.Text
b(3, 3) = txtb33.Text
cmdarray1.Enabled = True
cmdarray2.Enabled = True
cmdarray3.Enabled = True
cmdarray4.Enabled = True
cmdarray5.Enabled = True
cmdread.Enabled = False
End Sub
Private Sub Command1_Click()
End
End Sub

****----****----****
‫البرنامج العاشر‬

Dim a(2, 2) As Single: Dim b(2) As Single


Dim c(2, 2) As Single: Dim d(2) As Single
Dim sgdeta As Single
Private Sub cmdarray1_Click()
sgdeta = a(1, 1) * a(2, 2) - a(1, 2) * a(2, 1)
txtdeta.Text = sgdeta
If Not sgdeta = 0 Then
cmdarray2.Enabled = True
cmdarray3.Enabled = True
End If
End Sub
Private Sub cmdarray2_Click()
c(1, 1) = (1 / sgdeta) * a(2, 2)
c(1, 2) = -(1 / sgdeta) * a(1, 2)
c(2, 1) = -(1 / sgdeta) * a(2, 1)
c(2, 2) = (1 / sgdeta) * a(1, 1)
txtc11.Text = c(1, 1)
txtc12.Text = c(1, 2)
txtc21.Text = c(2, 1)
txtc22.Text = c(2, 2)
End Sub
Private Sub cmdarray3_Click()
d(1) = c(1, 1) * b(1) + c(1, 2) * b(2)
d(2) = c(2, 1) * b(1) + c(2, 2) * b(2)
txtd1.Text = d(1)
txtd2.Text = d(2)
End Sub
Private Sub cmdread_Click()
Rem read array A (a11,a12,a13-a21,a22)
a(1, 1) = txta11.Text: a(1, 2) = txta12.Text
a(2, 1) = txta21.Text: a(2, 2) = txta22.Text
Rem read array B (b11,b12,.....,b33)
b(1) = txtb1.Text
b(2) = txtb2.Text
cmdarray1.Enabled = True
cmdread.Enabled = False
End Sub
Private Sub Command1_Click()
End
End Sub

****----****----****
‫البرنامج الحادي عشر‬

Option Explicit
Option Base 1
Dim a(3, 3) As Single
Dim b(3) As Single
Dim c(3, 3) As Single
Dim d(3) As Single
Dim e(3, 3) As Single
Dim sgdeta As Single
Private Sub Cmdarray1_Click()
Dim sga As Single
Dim sgb As Single
Dim sgc As Single
sga = a(1, 1) * (a(2, 2) * a(3, 3) - a(2, 3) * a(3, 2))
sgb = -a(1, 2) * (a(2, 1) * a(3, 3) - a(2, 3) * a(3, 1))
sgc = a(1, 3) * (a(2, 1) * a(3, 2) - a(2, 2) * a(3, 1))
sgdeta = sga + sgb + sgc
Txtdeta.Text = sgdeta
Txtdeta.Text = sga
If Not sgdeta = 0 Then
Cmdarray2.Enabled = True
Cmdarray1.Enabled = False
End If
End Sub
Private Sub Cmdarray2_Click()
c(1, 1) = (1 / sgdeta) * (a(2, 2) * a(3, 3) - a(2, 3) * a(3, 2))
c(1, 2) = -(1 / sgdeta) * (a(1, 2) * a(3, 3) - a(1, 3) * a(3, 2))
c(1, 3) = (1 / sgdeta) * (a(1, 2) * a(2, 3) - a(1, 3) * a(2, 2))
c(2, 1) = -(1 / sgdeta) * (a(2, 1) * a(3, 3) - a(2, 3) * a(3, 1))
c(2, 2) = (1 / sgdeta) * (a(1, 1) * a(3, 3) - a(1, 3) * a(3, 1))
c(2, 3) = -(1 / sgdeta) * (a(1, 1) * a(2, 3) - a(1, 3) * a(2, 1))
c(3, 1) = (1 / sgdeta) * (a(2, 1) * a(3, 2) - a(2, 2) * a(3, 1))
c(3, 2) = -(1 / sgdeta) * (a(1, 1) * a(3, 2) - a(1, 2) * a(3, 1))
c(3, 3) = (1 / sgdeta) * (a(1, 1) * a(2, 2) - a(1, 2) * a(2, 1))
Txtc11.Text = c(1, 1)
Txtc12.Text = c(1, 2)
Txtc13.Text = c(1, 3)
Txtc21.Text = c(2, 1)
Txtc22.Text = c(2, 2)
Txtc23.Text = c(2, 3)
Txtc31.Text = c(3, 1)
Txtc32.Text = c(3, 2)
Txtc33.Text = c(3, 3)
Cmdarrayc.Enabled = True
Cmdarray2.Enabled = False
End Sub
Private Sub Cmdarray3_Click()
d(1) = c(1, 1) * b(1) + c(1, 2) * b(2) + c(1, 3) * b(3)
d(2) = c(2, 1) * b(1) + c(2, 2) * b(2) + c(2, 3) * b(3)
d(3) = c(3, 1) * b(1) + c(3, 2) * b(2) + c(3, 3) * b(3)
txtd1.Text = d(1)
Txtd2.Text = d(2)
Txtd3.Text = d(3)
txtnote.Text = "Multiblication inv(A)*B"
End Sub
Private Sub Cmdarrayc_Click()
Dim i As Byte
Dim j As Byte
Dim k As Byte
Dim sgsum As Single
For i = 1 To 3
For j = 1 To 3
sgsum = 0
For k = 1 To 3
sgsum = sgsum + a(i, k) * c(k, j)
Next k
e(i, j) = sgsum
Next j
Next i
Txte11.Text = Round(e(1, 1), 2)
Txte12.Text = Round(e(1, 2), 2)
Txte13.Text = Round(e(1, 3), 2)
Txte21.Text = Round(e(2, 1), 2)
Txte22.Text = Round(e(2, 2), 2)
Txte23.Text = Round(e(2, 3), 2)
Txte31.Text = Round(e(3, 1), 2)
Txte32.Text = Round(e(3, 2), 2)
Txte33.Text = Round(e(3, 3), 2)
txtnote.Text = "Multiblication A*inv(A)"
If (Round(e(1, 1), 2) = 1 & Round(e(1, 2), 2) = 0) Then
Cmdarray3.Enabled = True
lbli.Visible = True
Cmdarrayc.Enabled = False
End If
End Sub

Private Sub Cmdclear_Click()


Cmdarray1.Enabled = False
Cmdarray2.Enabled = False
Cmdarray3.Enabled = False
Cmdarrayc.Enabled = False
Cmdread.Enabled = True
txtnote.Text = "Note about Calculations will be here"
Txtc11.Text = "": Txtc12.Text = "": Txtc13.Text = ""
Txtc21.Text = "": Txtc22.Text = "": Txtc23.Text = ""
Txtc31.Text = "": Txtc32.Text = "": Txtc33.Text = ""
Txte11.Text = "": Txte12.Text = "": Txte13.Text = ""
Txte21.Text = "": Txte22.Text = "": Txte23.Text = ""
Txte31.Text = "": Txte32.Text = "": Txte33.Text = ""
Txtdeta.Text = ""
txtd1.Text = "": Txtd2.Text = "": Txtd3.Text = ""
lbli.Visible = False
End Sub
Private Sub Cmdread_Click()
Rem read array A (a11,a12,a13-a21,a22)
a(1, 1) = Txta11.Text
a(1, 2) = Txta12.Text
a(1, 3) = Txta13.Text
a(2, 1) = Txta21.Text
a(2, 2) = Txta22.Text
a(2, 3) = Txta23.Text
a(3, 1) = Txta31.Text
a(3, 2) = Txta32.Text
a(3, 3) = Txta33.Text
Rem read array B (b11,b12,.....,b33)
b(1) = Txtb1.Text
b(2) = Txtb2.Text
b(3) = Txtb3.Text
Cmdarray1.Enabled = True
Cmdread.Enabled = False
End Sub
****----****----****
‫البرنامج الثاني عشر‬

Option Explicit
Private Sub Cmdclear_Click()
Cmdreed1.Visible = True
Cmdreed2.Visible = False: Cmdreed3.Visible = False
txtfrst.Text = "": Txtbase.Text = ""
Txtnb.Text = "": Txtsum.Text = ""
Frame2.Visible = False
End Sub
Private Sub Cmdexit_Click()
End
End Sub
Private Sub Cmdreed1_Click()
Frame2.Visible = True
If Opt1.Value = True Then L1.Visible = True
If Opt2.Value = True Then L2.Visible = True
If Opt3.Value = True Then L3.Visible = True
If Opt3.Value = True Then Lblinf.Visible = True
If Opt3.Value = True Then Txtnb.Text = "10000"
Cmdreed2.Visible = True
Cmdreed1.Visible = False
End Sub
Private Sub Cmdreed2_Click()
Dim st1, st2, st3 As String
Dim inok As Byte
Dim sgbasee As Single
inok = 0
st1 = txtfrst.Text: st2 = Txtbase.Text: st3 = Txtnb.Text
If Len(st2) > 0 Then sgbasee = Txtbase.Text
If Opt2.Value = True Then
If sgbasee = 1 Then MsgBox ("In Geometric Series the base must be not
equal to one")
If sgbasee = 1 Then
Cmdreed1.Visible = True
Cmdreed2.Visible = False: Cmdreed3.Visible = False
txtfrst.Text = "": Txtbase.Text = "": Txtnb.Text = ""
Frame2.Visible = False
End If
End If
If Opt3.Value = True Then
If Abs(sgbasee) > 1 Then MsgBox ("In Inf. Geometric Series the
absolute value of base must be less than one")
If Abs(sgbasee) > 1 Then
Cmdreed1.Visible = True
Cmdreed2.Visible = False: Cmdreed3.Visible = False
txtfrst.Text = "": Txtbase.Text = "": Txtnb.Text = ""
Frame2.Visible = False
End If
End If
If Len(st1) > 0 Then If Len(st2) > 0 Then If Len(st3) > 0 Then inok = 1
If inok = 1 Then Cmdreed3.Visible = True: Cmdreed2.Visible = False
If Opt2.Value = True Then If sgbasee = 1 Then Cmdreed2.Visible =
False: Cmdreed3.Visible = False
If Opt3.Value = True Then If Abs(sgbasee) >= 1 Then
Cmdreed2.Visible = False: Cmdreed3.Visible = False
End Sub
Private Sub Cmdreed3_Click()
Dim sgfrst As Single: Dim sgbase As Single
Dim innb As Integer: Dim sgsum As Single
sgfrst = txtfrst.Text: sgbase = Txtbase.Text: innb = Txtnb.Text
If Opt1.Value = True Then
sgsum = 0.5 * innb * (2 * sgfrst + (innb - 1) * sgbase)
Txtsum.Text = sgsum
Txtsum.Visible = True
Lbl6.Visible = True
End If
If Opt2.Value = True Then
sgsum = sgfrst * (1 - sgbase ^ innb) / (1 - sgbase)
Txtsum.Text = sgsum
Txtsum.Visible = True
Lbl6.Visible = True
End If
If Opt3.Value = True Then
sgsum = sgfrst / (1 - sgbase)
Txtsum.Text = sgsum
Txtsum.Visible = True
Lbl6.Visible = True
End If
End Sub

****----****----****
‫البرنامج الثالث عشر‬

Option Explicit
Dim n1 As Single: Dim n2 As Byte:
Dim sum As Single
Private Sub cmdcompute_Click()
sum = 0
Dim i As Byte
For i = 1 To n2: sum = sum + n1 ^ i: Next i
txtf.Text = sum: cmdcompute.Enabled = False
End Sub
Private Sub cmdconf_Click()
Dim f1 As Byte: Dim f2 As Byte: Dim f3 As Byte
Rem testing entring the values in text boxs or NOT
If Len(txty) > 0 And Len(txtn) > 0 Then f1 = 1
Rem testing entring Sympols with the values in text boxs or NOT
If f1 = 1 Then
Dim a1 As String: a1 = Val(txty.Text)
Dim a2 As String: a2 = Val(txtn.Text)
If a1 = txty.Text And a2 = txtn.Text Then f2 = 1
End If
Rem testing the mathematical conditions for the three values
If f1 = 1 And f2 = 1 Then
n1 = txty.Text: n2 = txtn.Text
Dim sgn3 As Single: sgn3 = txtn.Text
Dim inn3 As Integer: inn3 = txtn.Text
If n1 <= 12.6 And n1 >= 3.7 Then
If inn3 = sgn3 And n2 <= 20 And n2 > 0 Then f3 = 1
End If
End If
Rem clearing
txtchk1.Visible = False: txtchk2.Visible = False: txtchk3.Visible = False
If f1 = 0 Then txtchk1.Visible = True
If f1 = 1 And f2 = 0 Then txtchk2.Visible = True
If f1 = 1 And f2 = 1 And f3 = 0 Then txtchk3.Visible = True
If f1 = 1 And f2 = 1 And f3 = 1 Then cmdcompute.Enabled = True:
cmdconf.Enabled = False: txtchk.Visible = True
End Sub
Private Sub Cmdoff_Click()
txty.Text = "":: txtn.Text = ""
txtf.Text = ""
txtchk1.Visible = False: txtchk2.Visible = False: txtchk3.Visible = False
txtchk.Visible = False
cmdcompute.Enabled = False: cmdconf.Enabled = True
End Sub
Private Sub cmdclose_Click()
End
End Sub

You might also like