I am having a problem with arguments for my Windows forms application.
I am using Visual basic. I have looked all over the place but couldn't find anything useful. I think that someone on here would have knowledge of Visual Basic enough to help me.
Variables:
1 2 3
Dim sLeft As String, sRight As String, sOperator As String
Dim iLeft As Double, iRight As Double, iResult As Double
Dim bLeft As Boolean
The code that doesn't work.
1 2 3 4 5 6 7 8 9 10 11
Private Sub AddOperator(sNewOperator As String)
If bLeft Then
sOperator = sNewOperator
bLeft = False
Else
btnEquals_Click()
sOperator = sNewOperator
sRight = ""
bLeft = False
End If
End Sub
This is the error message it gives me when I hover over the item:
Argument not specified for parameter 'sender' of 'Private Sub btnEquals_Click(sender As Object, e As System.EventArgs)'.
Private Sub btnEquals_Click(sender As Object, e As EventArgs)
If sLeft <> "" And sRight = "" And sOperator <> "" Then
sRight = sLeft
End If
If sLeft <> "" And sRight <> "" And sOperator <> "" Then
iLeft = sLeft
iRight = sRight
Select Case sOperator
Case "+"
iResult = iLeft + iRight
Case "-"
iResult = iLeft - iRight
Case "/"
iResult = iLeft / iRight
Case "*"
iResult = iLeft * iRight
End Select
tbResult.Text = iResult
sLeft = iResult
sRight = ""
bLeft = True
End If
End Sub
The code works when I set the code like this: Private Sub btnEquals_Click()
But it doesn't do anything.
i dont know. i have never used and hopefully never will use vb. but your error says that it expects something to be passed to it and you arent doing that