Type | Description | |||
Button as String | A string expression that indicates the name of the being clicked. The Button parameter does not include the HTML format. | |||
Cancel as Variant | (By Reference) A boolean expression that indicates whether the default operation is executed or canceled. |
The following VB6 sample adds a new button 'sin' and execute the trigonometric sin function when 'sin' button is clicked:
Private Sub Form_Load() With CalcCombo1 .Buttons = .Buttons + vbCrLf + "<b>sin<b>" End With End Sub
Private Sub CalcCombo1_ClickButton(ByVal Button As String, Cancel As Variant) If (Button = "sin") Then With CalcCombo1 .Execute Sin(.Caption) End With End If End Sub
The following VB.NET sample adds a new button 'sin' and execute the trigonometric sin function when 'sin' button is clicked:
Private Sub Excalc1_ClickButton(ByVal sender As System.Object, ByVal Button As System.String, ByRef Cancel As System.Boolean) Handles Excalc1.ClickButton If (Button = "sin") Then With Excalc1 .Execute(Math.Sin(.Caption)) End With End If If (Button = "cos") Then With Excalc1 .Execute(Math.Cos(.Caption)) End With End If End Sub
The following C# sample adds a new button 'sin' and execute the trigonometric sin function when 'sin' button is clicked:
private void excalc1_ClickButton(object sender, string Button, ref bool Cancel) { if (Button == "sin") excalc1.Execute(Math.Sin(Convert.ToDouble(excalc1.Caption)).ToString()); else if (Button == "cos") excalc1.Execute(Math.Cos(Convert.ToDouble(excalc1.Caption)).ToString()); }