I have a "if" or "case" statement in the a method that I can called. I have "Flag" varriable as public status. Its Crazy its loop/running for twice, so cause have duplicate command, in these case I have duplicate data on the database.
Public Sub compartment1(ByVal exec As Boolean)
Try
If exec = True Then
Select Case FlagMark
Case 1
Insert database execute command
Case 2
another command
End Select
ElseIf exec = False Then
End If
Catch ex As Exception
End Try
End Sub
And this is my button command
Private Sub cmd_confirm_Click(sender As Object, e As EventArgs) Handles cmd_confirm.Click
If pCheck2.Checked = True Then
FlagMark = 1
compartment1(True)
End If
End Sub
The Method "Compartment1" is running twice, look like looping, so I have a duplicate data or duplicate for single command. Can it running only once?