MessageBox appears twice [closed]

-3

I have the following code which is fired by Handles Button1.Click .

Dim X, Cf As Double
    Dim A, B, C, D, J As String
    A = TextBox2.Text
    B = TextBox3.Text
    C = TextBox4.Text
    D = TextBox9.Text
    J = ComboBox2.Text
    If J = "K" Then
        If W5() = "K" Then
            If A = "" Then : C1() : Else : X = TextBox2.Text : End If
        ElseIf W6() = "K" Then
            If B = "" Then : C1() : Else : X = TextBox3.Text : End If
        ElseIf W7() = "K" Then
            If C = "" Then : C1() : Else : X = TextBox4.Text : End If
        ElseIf W8() = "K" Then
            If D = "" Then : C1() : Else : X = TextBox5.Text : End If
        End If
        If X <> Nothing Then
            Cf = ((X * 78) / 94) / 100
        End If
    End If

Being C1() a warning message when the W (5 a 8) chosen is empty.
My problem is that when W is empty the MessageBox of C1() Appears twice, if W is not empty everything happens as scheduled. This is the code for my MessageBox:

Public Function C1()
    MessageBox.Show("Informe o valor!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Function

Could anyone help me here? C # answers are also accepted.

I apologize to everyone who took some time off to help me, the code was being fired twice, now it's back to normal. Thank you all for the help.

    
asked by anonymous 15.12.2015 / 15:59

1 answer

1

The message was appearing twice because the code mentioned was executed inside a function after clicking the application button, the problem was that I did not realize that the same button called another function that executed the same code.

It's like I'm double clicking. So I removed Handles Button1.Click repeated in one function and everything went right.

    
15.12.2015 / 17:00