user1932919
user1932919

Reputation: 13

Visual Basic 6: Run-time error 424 (If Function)

Sorry, I'm a beginner with VB6. I have this:

Private Sub Command5_Click()
    If MessageBox.Show("Sei sicuro di voler uscire?", "Sicuro?", MessageBoxButtons.YesNo) = DialogResult.Yes Then
        Unload Me
    End If
End Sub

But it returns an error:

Run-time error '424':
Object required

Please, may anyone answer my question?

Upvotes: 1

Views: 2055

Answers (1)

Ry-
Ry-

Reputation: 224867

MessageBox.Show and MessageBoxButtons are .NET things. (Why aren’t you using .NET, by the way? :)) Here’s what it looks like in VB6:

If MsgBox("Sei sicuro di voler uscire?", vbYesNo, "Sicuro?") = vbYes Then

Upvotes: 5

Related Questions