Определение гладкости бумаги по математической модели, страница 3

LblL9.Caption = Format(y(1), "#0.000")

LblL10.Caption = Format(y(2), "#0.000")

LblL11.Caption = Format(y(3), "#0.000")

Exit Do

Case 0

MsgBox "Введите число!", vbExclamation, "Ошибка"

Case Is < Ymin(I)

MsgBox "Слишком маленькое значение!", vbExclamation, "Ошибка"

Case Is > Ymax(I)

MsgBox "Слишком большое значение!", vbExclamation, "Ошибка"

End Select

Loop

Next I

LblL1.Visible = True

LblL2.Visible = True

LblL3.Visible = True

LblL9.Visible = True

LblL10.Visible = True

LblL11.Visible = True

CmdC1.Visible = True

End Sub

Private Sub Mnuload_Click()

'Показать данные предыдущего расчета

Open "D:\Gladkost.txt" For Input As #1

Input #1, G, x(1), x(2), x(3), x(4), y(1), y(2), y(3)

Close #1

LblL1.Visible = True

LblL2.Visible = True

LblL3.Visible = True

LblL4.Visible = True

LblL5.Visible = True

LblL6.Visible = True

LblL7.Visible = True

LblL8.Visible = True

LblL17.Visible = True

LblL18.Visible = True

LblL19.Visible = True

LblL20.Visible = True

LblL21.Visible = True

LblL22.Visible = True

LblL23.Visible = True

LblL24.Visible = True

LblL17.Caption = Format(y(1), "#0.000")

LblL18.Caption = Format(y(2), "#0.000")

LblL19.Caption = Format(y(3), "#0.000")

LblL20.Caption = Format(x(1), "#0.000")

LblL21.Caption = Format(x(2), "#0.000")

LblL22.Caption = Format(x(3), "#0.000")

LblL23.Caption = Format(x(4), "#0.000")

LblL24.Caption = Format(G, "#0.000")

End Sub

Private Sub Mnuprog_Click()

'О программе

MsgBox "Программа для расчёта гладкости бумаги по матетматической модели. 2007г.", vbInformation, "О ПРОГРАММЕ"

End Sub

Private Sub Mnuraschet_Click()

'Расчет

x(1) = A0 + A1 * y(1) - A2 * y(2)

x(2) = C0 + C1 * y(1)

x(3) = D0 + D1 * y(1) - D2 * y(2)

x(4) = E0 + E1 * y(1) - E2 * y(2) - E3 * y(3)

LblL4.Visible = True

LblL5.Visible = True

LblL6.Visible = True

LblL7.Visible = True

LblL12.Visible = True

LblL13.Visible = True

LblL14.Visible = True

LblL15.Visible = True

LblL16.Visible = True

LblL12.Caption = Format(x(1), "#0.000")

LblL13.Caption = Format(x(2), "#0.000")

LblL14.Caption = Format(x(3), "#0.000")

LblL15.Caption = Format(x(4), "#0.000")

G = B0 - B1 * x(1) + B2 * x(2) - B3 * x(3) + B4 * x(4)

LblL8.Visible = True

LblL16.Caption = Format(G, "#0.000")

End Sub

Private Sub Mnusave_Click()

'Сохранение результата

Open "D:\Gladkost.txt" For Output As #1

Write #1, G, x(1), x(2), x(3), x(4), y(1), y(2), y(3)

Close #1

End Sub

Окно «Калькулятор»

Коды:

Option Explicit

Dim Z As Single

Private Sub cmdc1_Click()

'Выполнение указанного математического действия

If OptO1.Value = True Then Z = Val(TxtT1.Text) + Val(TxtT2.Text)

If OptO2.Value = True Then Z = Val(TxtT1.Text) - Val(TxtT2.Text)

If OptO3.Value = True Then Z = Val(TxtT1.Text) * Val(TxtT2.Text)

If OptO4.Value = True Then

If Val(TxtT2.Text) = 0 Then

MsgBox "На ноль делить нельзя!!!", vbCritical, "Ошибка"

Else

Z = Val(TxtT1.Text) / Val(TxtT2.Text)

End If

End If

LblL4.Caption = Format(Z, "#0.000")

End Sub

Private Sub cmdc2_Click()

'Переход к форме Расчет

Kalkulator.Hide

Raschet.Show

End Sub

Окно «День Рождения»

Коды:

Option Explicit

Dim Z As Single

Private Sub CmdC1_Click()

'Расчет

Z = DateDiff(CStr(TxtT3.Text), CDate(TxtT1.Text), CDate(TxtT2.Text))

If TxtT3.Text = "yyyy" Then LblL5.Caption = Z & " Лет"

If TxtT3.Text = "q" Then LblL5.Caption = Z & " Кварталов"

If TxtT3.Text = "m" Then LblL5.Caption = Z & " Месяцев"

If TxtT3.Text = "w" Then LblL5.Caption = Z & " Недель"

If TxtT3.Text = "d" Then LblL5.Caption = Z & " Дней"

If TxtT3.Text = "h" Then LblL5.Caption = Z & " Часов"

If TxtT3.Text = "n" Then LblL5.Caption = Z & " Минут"

If TxtT3.Text = "s" Then LblL5.Caption = Z & " Секунд"

End Sub

Private Sub CmdC2_Click()

'Переход к форме Расчет

Date.Hide

Raschet.Show

End Sub

Private Sub Form_Load()

'Автоматический вывод системной даты

TxtT3.Text = CStr(Date)

End Sub

6. Контрольный пример

7.Логическая схема работы.

8.Логическая схема работы программы.