I was having a discussion with a co worker just now and we discussed the idea of a message box coming up as part of a search and displaying a JPG picture as part of the results. Is that even possible? If so then how difficult would it be to add it? Thanks for settling this discussion.

As far as my knowledge stretch, the msgbox can not accept pictures... That made me develop my own message box which works wonders. Below is some code you can use to create your own message boxes. You can add pictures to your hearts content...

In a module, add the following... (You will notice that I don't use all of the boxes...)

Option Explicit

Public Function MsgQuestion(Msg As String, Title As String, FirstButton As String, SecondButton As String) As String

With frmMessageQuestion
    .lblTitle.Caption = Title
    .lblMessage.Caption = Msg
    .cmdReturn(0).Caption = FirstButton
    .cmdReturn(1).Caption = SecondButton
    '.Image1(0).Picture = .imglstMessage.ListImages(2).Picture
    '.image2(1).Picture = .imglstMessage.ListImages(3).Picture
    .Show 1
        DoEvents
        MsgQuestion = .Tag
        Unload frmMessageQuestion
End With
End Function

Public Function MsgOkOnly(Msg As String, Title As String, FirstButton As String, SecondButton As String) As String

On Error Resume Next

With frmMessageOkOnly
    .lblTitle.Caption = Title
    .lblMessage.Caption = Msg
    .cmdReturn(0).Caption = FirstButton
    '.cmdReturn(1).Caption = SecondButton
    '.image1(0).Picture = .imglstMessage.ListImages(2).Picture
    '.image2(1).Picture = .imglstMessage.ListImages(3).Picture
    .Show 1
        DoEvents
        MsgOkOnly = .Tag
        Unload frmMessageOkOnly
End With
End Function

Public Function MsgOkCancel(Msg As String, Title As String, FirstButton As String, SecondButton As String) As String

'With frmMsgOkCancel
    '.lblTitle.Caption = Title
    '.lblMessage.Caption = Msg
    '.cmdReturn(0).Caption = FirstButton
    '.cmdReturn(1).Caption = SecondButton
    '.image1(0).Picture = .imglstMessage.ListImages(2).Picture
    '.image2(1).Picture = .imglstMessage.ListImages(3).Picture
    '.Show 1
        'DoEvents
        'MsgOkCancel = .Tag
       ' Unload frmMsgOkCancel
'End With
End Function

In your form, call the message box as follows...

Dim strMessage As String

strMessage = MsgQuestion("Please register your Product and create the Setup Data to continue.", "Register Product - Create Setup Data", "Ok, Continue With Registration", "Register Later")

''MsgQuestion calls the appropriate box you want to use...
''First part is the actual message...
''second part is the title...
''third part is the button yes title...
''fourth part is the button no title

Have a look at the code in the module. Create a form for each messagebox, called frmMsgQuestion etc. Also pay attention to the controls needed in the form - labels, commandbuttons etc. In my case, I have made use of images as command buttons (cmdReturn(0),cmdReturn(1) )

You can now also add other static images in the form that will be displayed. Also set the form properties to show in the centre of screen etc...

Dont know in VB but in java you can ..
However I found similar question asked previousle here in Daniweb...

Check this

Wow thanks! I will pass this on to my co worker and let him know!

Only a pleasure. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.