Page 134 - Open Soource Technologies 304.indd
P. 134
Event Driven Programming
2: The following program requests the costs and revenue for a company and
displays the message “Break even” if the costs and revenue are equal;
otherwise, it displays the profit or loss. The action following Else is another
If block.
Object Property Setting
frmStatus Text Profit/Loss
lblCosts Text Costs:
txtCosts
lblRev Text Revenue:
txtRev
btnShow Text Show Financial Status
txtResult Read Only True
Private Sub btnShow_Click(...) Handles btnShow.Click
Dim costs, revenue, profit, loss As Double
costs = CDbl (txtCosts.Text)
revenue = CDbl (txtRev.Text)
If costs = revenue Then
128 LOVELY PROFESSIONAL UNIVERSITY