Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- Private Type Gold
- countryname As String * 15
- year(5) As Integer
- max As Integer
- maxyear As Integer
- average As Integer
- End Type
- Dim a1 As Gold
- Dim a2 As Gold
- Dim cout As String
- Dim endl As String
- Dim n As Integer
- Dim ind As Integer
- Dim sum As Currency
- Dim k As Integer
- Dim summ As Currency
- Dim s As String
- Dim c As String
- Dim nom As Integer
- Dim st As String
- Private Sub btnDelete_Click()
- ind = ListBox1.ListIndex
- ListBox1.RemoveItem ind
- btnDelete.Enabled = False
- btnEdit.Enabled = False
- Dim j As Integer
- TB1.Enabled = True
- TB2.Enabled = True
- TB3.Enabled = True
- TB4.Enabled = True
- TB5.Enabled = True
- TB6.Enabled = True
- btnOK.Enabled = True
- j = ListBox1.ListIndex
- st = ListBox1.List(j)
- Form2.Caption = st
- btnDelete.Enabled = True
- nom = 1
- s = ""
- For k = 1 To Len(st)
- c = Mid(st, k, 1)
- If c = " " And s <> " " Then nom = nom + 1: s = " "
- If c <> " " Then s = s + c
- Select Case nom
- Case 1: TB1 = s
- Case 2: TB2 = Val(s)
- Case 3: TB3 = Val(s)
- Case 4: TB4 = Val(s)
- Case 4: TB5 = Val(s)
- Case 4: TB6 = Val(s)
- End Select
- Next k
- TB1.Enabled = False
- TB2.Enabled = False
- TB3.Enabled = False
- TB4.Enabled = False
- TB5.Enabled = False
- TB6.Enabled = False
- End Sub
- Private Sub btnEdit_Click()
- Dim j As Integer
- TB1.Enabled = True
- TB2.Enabled = True
- TB3.Enabled = True
- TB4.Enabled = True
- TB5.Enabled = True
- TB6.Enabled = True
- btnOK.Enabled = True
- j = ListBox1.ListIndex
- st = ListBox1.List(j)
- Form2.Caption = st
- btnDelete.Enabled = True
- nom = 1
- s = ""
- For k = 1 To Len(st)
- c = Mid(st, k, 1)
- If c = " " And s <> " " Then nom = nom + 1: s = " "
- If c <> " " Then s = s + c
- Select Case nom
- Case 1: TB1 = s
- Case 2: TB2 = Val(s)
- Case 3: TB3 = Val(s)
- Case 4: TB4 = Val(s)
- Case 4: TB5 = Val(s)
- Case 4: TB6 = Val(s)
- End Select
- Next k
- 'ListBox1.RemoveItem j
- btnEdit.Enabled = True
- btnDelete.Enabled = True
- End Sub
- Private Sub btnExit_Click()
- End
- End Sub
- Private Sub btnInput_Click()
- TB1.Enabled = True
- TB2.Enabled = True
- TB3.Enabled = True
- TB4.Enabled = True
- TB5.Enabled = True
- TB6.Enabled = True
- TB1.Text = ""
- TB2.Text = ""
- TB3.Text = ""
- TB4.Text = ""
- TB5.Text = ""
- TB6.Text = ""
- btnInput.Enabled = False
- btnOK.Enabled = True
- End Sub
- Private Sub btnList_Click()
- Dim l As Integer
- Dim i As Integer
- l = Len(a1.countryname)
- s = a1.countryname + Space(15 - l)
- For i = 1 To 5
- l = Len(Str(a1.year(i)))
- s = s + Str(a1.year(i)) + Space(6 - l)
- Next i
- l = Len(Str(a1.average))
- s = s + Str(a1.average) + Space(7 - l)
- l = Len(Str(a1.max))
- s = s + Str(a1.max) + Space(8 - l)
- l = Len(Str(a1.maxyear))
- s = s + Str(a1.maxyear) + Space(8 - l)
- ListBox1.AddItem s
- btnO.Enabled = True
- btnList.Enabled = False
- btnInput.Enabled = True
- End Sub
- Private Sub btnO_Click()
- Dim s As String
- Dim ssr As Long
- Dim sr1 As Long
- Dim sr2 As Long
- Dim sr3 As Long
- Dim sr4 As Long
- Dim sr5 As Long
- Dim k As Integer
- Dim maxindex As Integer
- Dim max As Long
- Dim nom As Integer
- Dim n As Integer
- Dim i As Integer
- Dim j As Integer
- Dim l As Integer
- Dim c As String
- Dim st As String
- LabelAvgValue.Visible = True
- n = ListBox1.ListCount
- max = 0
- ssr = 0
- maxindex = 0
- For i = 0 To n
- ind = i
- If i = n Then ind = maxindex
- st = ListBox1.List(ind)
- nom = 0
- s = ""
- For k = 1 To Len(st)
- c = Mid(st, k, 1)
- If c <> " " Then s = s + c
- If c = " " And s <> "" Then
- nom = nom + 1
- Select Case nom
- Case 1: TB1 = s
- Case 2: TB2 = Val(s)
- Case 3: TB3 = Val(s)
- Case 4: TB4 = Val(s)
- Case 5: TB5 = Val(s)
- Case 6: TB6 = Val(s)
- End Select
- s = ""
- End If
- Next k
- 'If a1.average > max Then
- 'max = a1.average
- 'maxindex = ind
- 'End If
- a1.average = 0
- For j = 1 To 5
- a1.average = a1.average + a1.year(j)
- Next j
- a1.average = a1.average / 5
- If i < n Then
- sr1 = sr1 + a1.year(1)
- sr2 = sr2 + a1.year(2)
- sr3 = sr3 + a1.year(3)
- sr4 = sr4 + a1.year(4)
- sr5 = sr5 + a1.year(5)
- ssr = ssr + a1.average
- End If
- Next i
- If n > 0 Then
- sr1 = sr1 / n
- sr2 = sr2 / n
- sr3 = sr3 / n
- sr4 = sr4 / n
- sr5 = sr5 / n
- ssr = ssr / n
- End If
- l = Len(Str(sr1))
- s = s + Str(sr1) + Space(13 - 1)
- l = Len(Str(sr2))
- s = s + Str(sr2) + Space(13 - 1)
- l = Len(Str(sr3))
- s = s + Str(sr3) + Space(13 - 1)
- l = Len(Str(sr4))
- s = s + Str(sr4) + Space(13 - 1)
- l = Len(Str(sr5))
- s = s + Str(sr5) + Space(13 - 1)
- l = Len(ssr)
- s = s + Str(ssr) + Space(13 - 1)
- LabelAVG.Caption = s
- End Sub
- Private Sub btnOK_Click()
- endl = Chr(13) + Chr(10)
- Dim i As Integer
- a1.average = 0
- For i = 1 To 5
- a1.average = a1.average + a1.year(i)
- Next i
- a1.average = a1.average / 5
- a1.max = a1.year(1)
- a1.maxyear = 1
- If a1.year(2) > a1.max Then a1.max = a1.year(2): a1.maxyear = 2
- If a1.year(3) > a1.max Then a1.max = a1.year(3): a1.maxyear = 3
- If a1.year(4) > a1.max Then a1.max = a1.year(4): a1.maxyear = 4
- If a1.year(5) > a1.max Then a1.max = a1.year(5): a1.maxyear = 5
- btnList.Enabled = True
- cout = "Íàçâàíèå còðàíû: " + a1.countryname + endl
- cout = cout + "Çîëîòîäîáû÷à:" + endl
- cout = cout + "Ãîä 1 - " + Str(a1.year(1)) + endl
- cout = cout + "Ãîä 2 - " + Str(a1.year(2)) + endl
- cout = cout + "Ãîä 3 - " + Str(a1.year(3)) + endl
- cout = cout + "Ãîä 4 - " + Str(a1.year(4)) + endl
- cout = cout + "Ãîä 5 - " + Str(a1.year(5)) + endl
- cout = cout + "Ñðåäíÿÿ çîëîòîäîáû÷à - " + Str(a1.average) + endl
- cout = cout + "Ìàêñèìàëüíàÿ çîëîòîäîáû÷à - " + Str(a1.max) + endl
- cout = cout + "Ãîä ñ ìàêñ. çîëîòîäîáû÷åé - " + Str(a1.maxyear) + endl
- For i = 1 To 5
- summ = summ + a1.year(i)
- Next i
- lbOut.Caption = "Çîëîòîäîáû÷à çà 5 ëåò: " + Str(summ)
- TB1.Enabled = False
- TB2.Enabled = False
- TB3.Enabled = False
- TB4.Enabled = False
- TB5.Enabled = False
- TB6.Enabled = False
- btnOK.Enabled = False
- btnList.Enabled = True
- btnInput.Caption = "Äîáàâèòü çàïèñü"
- End Sub
- Private Sub Label1_Click()
- End Sub
- Private Sub LabelAVG_Click()
- End Sub
- Private Sub lb6_Click()
- End Sub
- Private Sub lb8_Click()
- End Sub
- Private Sub lb9_Click()
- End Sub
- Private Sub LB10_Click()
- End Sub
- Private Sub lb11_Click()
- End Sub
- Private Sub lb12_Click()
- End Sub
- Private Sub lb13_Click()
- End Sub
- Private Sub lb14_Click()
- End Sub
- Private Sub lb15_Click()
- End Sub
- Private Sub lb16_Click()
- End Sub
- Private Sub ListBox1_Click()
- Dim j As Integer
- j = ListBox1.ListIndex
- st = ListBox1.List(j)
- Form2.Caption = st
- nom = 1
- s = ""
- For k = 1 To Len(st)
- c = Mid(st, k, 1)
- If c = " " And s <> " " Then nom = nom + 1: s = " "
- If c <> " " Then s = s + c
- Select Case nom
- Case 1: TB1 = s
- Case 2: TB2 = Val(s)
- Case 3: TB3 = Val(s)
- Case 4: TB4 = Val(s)
- Case 5: TB5 = Val(s)
- Case 6: TB6 = Val(s)
- End Select
- Next k
- btnEdit.Enabled = True
- btnDelete.Enabled = True
- End Sub
- Private Sub TB1_Change()
- a1.countryname = TB1
- End Sub
- Private Sub TB2_Change()
- a1.year(1) = Val(TB2)
- End Sub
- Private Sub TB3_Change()
- a1.year(2) = Val(TB3)
- End Sub
- Private Sub TB4_Change()
- a1.year(3) = Val(TB4)
- End Sub
- Private Sub TB5_Change()
- a1.year(4) = Val(TB5)
- End Sub
- Private Sub TB6_Change()
- a1.year(5) = Val(TB6)
- End Sub
- Private Sub form_Click()
- End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement