download
order  

Visual Basic 6 and VBA code fragments for Dialogs

 

In the Visual Basic 6 code fragments below are included in the Code-VB fragments library.
Fragments are snippets of code you can insert in your procedures.
Each item between braces correspond to a variable of the given type.
They are replaced with the new or existing variables by Fragment Builder in Code-VB tools.

Dialog Does not Exist - Create Yes-No

Select Case MsgBox({STRING:Prompt=" doesn't exist" & vbcrlf & "Do you want to create it?"}, vbYesNo + vbQuestion)
Case vbYes
    
Case vbNo
    
End Select

Dialog Give Date

Dim var As String
Do
    var = InputBox({STRING:Text="Give Date"})
    If Len(var) = 0 Then GoTo {HANDLEEXITLABEL}
    If Not IsDate(var) Then MsgBox {STRING:Text="You should enter a date"}, vbExclamation
Loop While Not (IsDate(var))

Dialog Give Number

Dim var As String
GiveNumberRetry:
var = InputBox({STRING:Request="Give Number"},,var)
If Len(var) = 0 Then GoTo {HANDLEEXITLABEL}
On Error Resume Next
{VARIANT} = var
If Err > 0 Then
    MsgBox {STRING:ErrorMessage="You should enter a Number"}, vbExclamation
    Err = 0
    GoTo GiveNumberRetry
End If

Dialog Remove Yes-No

Select Case MsgBox({STRING:Prompt="  will be removed" & vbcrlf & "Continue?"}, vbYesNo + vbQuestion)
Case vbYes
    
Case vbNo
    
End Select

Dialog Replace Yes-No

Select Case MsgBox({STRING:Prompt="  already exists" & vbcrlf & "Do you want to replace?"}, vbYesNo + vbQuestion)
Case vbYes
    
Case vbNo
    
End Select

Dialog Save Changes Yes-No

Select Case MsgBox({STRING:Prompt="Save changes?"}, vbYesNo + vbQuestion)
Case vbYes
    
Case vbNo
    
End Select

Msgbox OK

MsgBox({STRING:Prompt})

Msgbox OK-Cancel

Select Case MsgBox({STRING:Prompt}, vbOkCancel + vbQuestion)
Case vbOK
    
Case vbCancel
    
End Select

Msgbox Retry-Cancel

Select Case MsgBox({STRING:Prompt}, vbRetryCancel + vbQuestion)
Case vbRetry
    
Case vbCancel
    
End Select

Msgbox Yes-No

Select Case MsgBox({STRING:Prompt}, vbYesNo + vbQuestion)
Case vbYes
    
Case vbNo
    
End Select

Msgbox Yes-No-Cancel

Select Case MsgBox({STRING:Prompt}, vbYesNoCancel + vbQuestion)
Case vbYes
    
Case vbNo

Case vbCancel
    
End Select

Dialogs Msgbox Yes-No-Cancel