48221 Lecture 6: Tute 6 P4

35 views4 pages
26 Jun 2018
School
Department
Course
Professor
Tutorial 6 Problem 4 code for VBA:
Private Sub CmdCalc_Click()
'inputs
SideB = TxtSideB.Value
AngleB = TxtX.Value
AngleC = TxtAngleC.Value
SideA = TxtX.Value
Pi = 4 * Atn(1)
'Calculations note: have to convert angles from deg to rad in excel
If OptSin.Value = True Then
SideC = SideB * (Sin(AngleC) / Sin(AngleB * Pi / 180))
Else
SideC = Sqr(SideA ^ 2 + SideB ^ 2 - 2 * SideA * SideB * Cos(AngleC * Pi / 180))
End If
'output and switch to second page
MultiPage1.Value = 1 'Value od 0 if page 1 and value of 1 is page 2
LblOutput.Caption = "Side C=" & Round(SideC, 2)
End Sub
Private Sub CmdExit_Click()
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows page 1 of the document.
Unlock all 4 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents