Ok, I got to the event. I can now make it like this:
Code:
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
btnQuit_Click
Cancel = 1
End Sub
Code:
Private Sub btnQuit_Click()
Dim lAnswer As Long
If pblstrLng = "Eng" Then
lAnswer = MsgBox(Prompt:="Really exit?", Buttons:=vbYesNo + vbQuestion, Title:="Exit?")
If lAnswer = vbYes Then
Unload Me
Else
Exit Sub
End If
Else
frmPoistutaanko.Show
End If
End Sub
It doesn't work. What's wrong?
The idea is to have two closing methods, clicking Quit and clicking that "Red X". It shouldn't matter which one I click. What should matter is the radiobuttons between Finnish and English. The function for clicking that radio button is:
Code:
Function VaihdaKieli(strLng As String) As String
If strLng = "Fin" Then
lblINI.Caption = "INI tiedosto:"
lblSource.Caption = "Lähdetiedosto:"
lblTemp.Caption = "Väliaikaistiedosto:"
lblResults.Caption = "Tulostiedosto:"
btnGet.Caption = "Hae tagit"
btnNotePad.Caption = "Avaa muistio"
btnQuit.Caption = "Poistu"
pblstrLng = "Fin"
Else
lblINI.Caption = "Location of INI File:"
lblSource.Caption = "Location of Source File:"
lblTemp.Caption = "Location of Temp File:"
btnGet.Caption = "Get tags"
btnQuit.Caption = "Quit"
btnNotePad.Caption = "Open Notepad"
lblResults.Caption = "Location of Results File:"
pblstrLng = "Eng"
End If
VaihdaKieli = pblstrLng
End Function
So there's 2x2x2 options. Clicking Cancel on msgbox (Or "ei", btnEi on frmPoistutaanko) shouldn't matter, it still should just act like "the Red X" or btnQuit was never pressed.
Right now
1.1.) Pressing btnQuit with radiobutton optEnglish active works right, it displays the msgbox (works correctly).
1.1.1.) Pressing there "No" works correctly.
1.1.2.) Pressing there "Yes" doesn't work right, it displays that "Really Exit"-msgbox once and on the second time it acts like pressing "No".
1.2.) Pressing btnQuit with radiobutton optFinnish active it displays that frmPoistutaanko (works correctly)
1.2.1.) Pressing btnJoo (yes) there works correctly, it exits the program.
1.2.2.) Pressing btnEi (no) there works correctly, it closes the form.
1.1.) Pressing "The Red X" with radiobutton optEnglish active works right, it displays the msgbox (works correctly).
1.1.1.) Pressing there "No" works correctly.
1.1.2.) Pressing there "Yes" doesn't work right, it acts like pressing "No".
2.2.) Pressing "The Red X" with radiobutton optFinnish active it displays that frmPoistutaanko (works correctly)
2.2.1.) Pressing btnJoo (yes) there works correctly, it exits the program.
2.2.2.) Pressing btnEi (no) there works correctly, it closes the form.
So how do I correct that English "Yes"?