-3
I have the following code which is triggered 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 the W be empty the Messagebox of C1() Appears twice if the W not empty everything happens as programmed.
This is the code of my Messagebox:
Public Function C1()
    MessageBox.Show("Informe o valor!", "Atenção", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End Function
Could someone help me here? Answers in C# are also accepted.
I apologize to everyone who took a little time to help me, the code was being fired twice, now it’s back to normal. Thank you all for your help.
Who
W? There is noWsome. Only with this passage can not help.– Maniero
@bigown would be W5, W6, W7, W8
– Alex Nunes
A String
Kcan only appear in one of the fourW, and where it is the referred W will be indicated as verification in the related Textbox.– Alex Nunes
I think code is missing in the example. What’s in the question seems to be right.
– Jéf Bueno
What you posted is a if elseif, it will never get into two even if more than one W is "k", have you debugged that if to see where it is going? Likely to be elsewhere your problem.
– Ricardo
I debug @Ricardo and gives the same thing, without informing any error, I did tests with k being once in W5 and another in W6, but when he checks the Textbox referring to that W (when it is empty) he gives the message twice.
– Alex Nunes
What would be the event that’s triggering this? Put that in the question as well. Maybe it’s firing twice.
– Ricardo
It is shot by Button1.Click @Ricardo
– Alex Nunes
@Alexnunes, Good that your problem has been solved. Now, create an answer what you did to solve your problem.. This can be useful for someone else in the future.
– emanuelsn
This problem has already been solved.
– Gabriel Rodrigues