user18974397
user18974397

Reputation:

How to break operation of if else in vb6

Hello i have this code in vb6 and i want the code to break operation if i click the cancel button but i cant seem to do it i searched online and found nothing, is it possible to do it? This is the code below:

if value <= temp then
    if (msgbox("Select an option", vbOKCANCEL + vbExclamation, MSG_TITLE) = vbCancel) Then
        'i want the code to break here and stop as it is to do nothing
    else
        'extra code
    end if
end if

Any idea how can i do that i think vb6 doesnt have BREAK as a function

Upvotes: 2

Views: 424

Answers (2)

arjumaraf
arjumaraf

Reputation: 1

if value <= temp then
    if (msgbox("Select an option", vbOKCANCEL + vbExclamation, MSG_TITLE) = vbCancel) Then
        goto keluar
    else
        'extra code
    end if
end if
keluar:

Upvotes: -1

GSerg
GSerg

Reputation: 78210

if value <= temp then
    if msgbox("Select an option", vbOkCancel Or vbExclamation, MSG_TITLE) = vbCancel Then
        ' Do nothing
    else
        ' extra code
    end if
end if
if value <= temp then
    if msgbox("Select an option", vbOkCancel Or vbExclamation, MSG_TITLE) <> vbCancel Then
        ' extra code
    end if
end if
if value <= temp then
    if msgbox("Select an option", vbOkCancel Or vbExclamation, MSG_TITLE) = vbCancel Then
        Exit Sub
    else
        ' extra code
    end if
end if

Upvotes: 3

Related Questions