On my code let's say I have 2 forms
On the main one is the DataGridView, it contains a column called ActivityStatus, which displays if the member is either Stopped/On-going I have a second form that I open by double clicking on a row, which gives me all the member's details, and at the bottom of the form there's a button that has a password; if written correctly, it should switch his ActivityStatus (if he's stopped; he'll become ongoing, vice versa) Here's the code I wrote for it
In form 1:
Private Sub DGVData_CellContentDoubleClick(sender As Object, e As DataGridViewCellEventArgs) Handles DGVData.CellContentDoubleClick
Dim SV As New -- [FORM 2 NAME HERE]
If e.RowIndex >= 0 Then
Dim Row As DataGridViewRow
Row = DGVData.Rows(e.RowIndex)
SV.ActivityChange = Row.Cells("ActivityStatus").Value.ToString
SV.IDVerify = Row.Cells("ID").Value.ToString
ED.Show()
End If
End Sub
In form 2:
Public Class StatusVertificationBox
Public Property ActivityChange As String
Public Property IDVerify As String
Private Sub StatusPassBtn_Click(sender As Object, e As EventArgs) Handles StatusPassBtn.Click
If StatusPassTxt.Text = "password123" Then
If ActivityChange = 1 Then
Dim Ask As MsgBoxResult
Ask = MsgBox("Are you sure?")
If Ask = MsgBoxResult.Yes Then
Dim MakeActiveCmd As String = "UPDATE InitialTable " &
"SET ActivityStatus = 0 " &
"WHERE ID='" & IDVerify & "' "
MsgBox("This member's membership has been stopped")
ElseIf Ask = MsgBoxResult.No Then
MsgBox("No modifications have been made")
End If
ElseIf ActivityChange = 0 Then
Dim Ask As MsgBoxResult
Ask = MsgBox("Are you sure?")
If Ask = MsgBoxResult.Yes Then
Dim MakeInactiveCmd As String = "UPDATE InitialTable " &
"SET ActivityStatus = 1 " &
"WHERE ID='" & IDVerify & "' "
MsgBox("This member's membership has been renewed")
ElseIf Ask = MsgBoxResult.No Then
MsgBox("No modifications have been made")
End If
End If
Me.Close()
Else
MsgBox("Incorrect Password, please try again.")
StatusPassTxt.Clear()
End If
End Sub
I don't understand where the issue is. The IF statement isn't working properly (the text displays on the MsgBox doesn't match the statement, and the value isn't changing at all on the datagridview)
Any help would be highly appreciated, thanks for reading guys
Aucun commentaire:
Enregistrer un commentaire