How to display a image in message box

  • (2 Pages)
  • +
  • 1
  • 2

15 Replies - 44164 Views - Last Post: 27 January 2009 - 09:07 AM Rate Topic: -----

#1 mechsoft_developer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 21-January 09

How to display a image in message box

Post icon  Posted 27 January 2009 - 04:26 AM

Hi

Can any one explain how to display a jpeg or bmp image in message box.
Please demonstrate through a simple code

Thanks and regards
MechSOft Developer
Is This A Good Question/Topic? 0
  • +

Replies To: How to display a image in message box

#2 narmer93  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 317
  • Joined: 13-March 08

Re: How to display a image in message box

Posted 27 January 2009 - 05:15 AM

Message box can't include images except icons as information and exclamation ...... and that stuff,beside that ,you can insert a new item. maybe a dialog project ►add new item . maybe a dialog result and add a picbox in it with the pic you want and then use dialog1.show to show it
good luck
Was This Post Helpful? 0
  • +
  • -

#3 mechsoft_developer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 21-January 09

Re: How to display a image in message box

Posted 27 January 2009 - 05:38 AM

View Postnarmer93, on 27 Jan, 2009 - 04:15 AM, said:

Message box can't include images except icons as information and exclamation ...... and that stuff,beside that ,you can insert a new item. maybe a dialog project ►add new item . maybe a dialog result and add a picbox in it with the pic you want and then use dialog1.show to show it
good luck


I wanted to display a messgbox along with a image but as you are saying its not possible can i be able to display a messg box and a seaprate window with 'pic box' as a popup with the same button click
Was This Post Helpful? 0
  • +
  • -

#4 narmer93  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 317
  • Joined: 13-March 08

Re: How to display a image in message box

Posted 27 January 2009 - 05:47 AM

u mean 2 actions in the button click, i guess that you just want both msg and pic to be appeared,well i suggest the dialog as i said in the previous post,the dialog is exaclty the same as a form,you can use it and add all controls in it as the form so you can add a picbox control in it with the pic you want and you can add a label with text=the message of the msgbox you wanted to show.
you can use dialog1.show() to show the dialog
do you want me to upload you a simple project to do that too?
good luck man:D
Was This Post Helpful? 0
  • +
  • -

#5 mechsoft_developer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 21-January 09

Re: How to display a image in message box

Posted 27 January 2009 - 06:26 AM

View Postnarmer93, on 27 Jan, 2009 - 04:47 AM, said:

u mean 2 actions in the button click, i guess that you just want both msg and pic to be appeared,well i suggest the dialog as i said in the previous post,the dialog is exaclty the same as a form,you can use it and add all controls in it as the form so you can add a picbox control in it with the pic you want and you can add a label with text=the message of the msgbox you wanted to show.
you can use dialog1.show() to show the dialog
do you want me to upload you a simple project to do that too?
good luck man:D


Please can you upload a simple project to demonstrate this action. As I am struggling to change any properties of dialog box through the code

My message box code looks like this: MsgBox("The insulation thickness is " & String.Format("{0:n2}", (T + 2)) & " mm")
Was This Post Helpful? 0
  • +
  • -

#6 narmer93  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 317
  • Joined: 13-March 08

Re: How to display a image in message box

Posted 27 January 2009 - 06:46 AM

well i hope that the file in the attachments is ok

Attached File(s)


Was This Post Helpful? 0
  • +
  • -

#7 mechsoft_developer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 21-January 09

Re: How to display a image in message box

Posted 27 January 2009 - 07:14 AM

View Postnarmer93, on 27 Jan, 2009 - 05:46 AM, said:

well i hope that the file in the attachments is ok


Thanks for the example but what is the difference between dialog and msgbox. Since I am using 'MsgBox' in my code and where to add picture file path in your code?

Regards
Was This Post Helpful? 0
  • +
  • -

#8 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1642
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: How to display a image in message box

Posted 27 January 2009 - 07:29 AM

A MessageBox cannot contain any GUI controls, plain and simple. The only way you're going to get even close to this is to create a form that looks like a MessageBox
Was This Post Helpful? 0
  • +
  • -

#9 mechsoft_developer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 21-January 09

Re: How to display a image in message box

Posted 27 January 2009 - 07:36 AM

View PostPsychoCoder, on 27 Jan, 2009 - 06:29 AM, said:

A MessageBox cannot contain any GUI controls, plain and simple. The only way you're going to get even close to this is to create a form that looks like a MessageBox


can we link or activate a secondary form or form 2 with a image and message by the click of button if so..please provide a simple example
Was This Post Helpful? 0
  • +
  • -

#10 narmer93  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 317
  • Joined: 13-March 08

Re: How to display a image in message box

Posted 27 January 2009 - 07:52 AM

what i was talking about(dialog) is exactly the same as form2 ,they are both the same and they can both help you make the same things
in a button in the first form,type
form2.show()

this will show the form ,
you can use
Dialog1.Label1.Text ="The insulation thickness is " & String.Format("{0:n2}", (T + 2)) & " mm" 
        Dialog1.PictureBox1.ImageLocation = "pic exact location"

good luck☺
Was This Post Helpful? 0
  • +
  • -

#11 mechsoft_developer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 21-January 09

Re: How to display a image in message box

Posted 27 January 2009 - 08:25 AM

View Postnarmer93, on 27 Jan, 2009 - 06:52 AM, said:

what i was talking about(dialog) is exactly the same as form2 ,they are both the same and they can both help you make the same things
in a button in the first form,type
form2.show()

this will show the form ,
you can use
Dialog1.Label1.Text ="The insulation thickness is " & String.Format("{0:n2}", (T + 2)) & " mm" 
        Dialog1.PictureBox1.ImageLocation = "pic exact location"

good luck☺


Thanks again but it is giving an error saying that 'Name Dialog1 is not declared'. Plzz help
Was This Post Helpful? 0
  • +
  • -

#12 narmer93  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 317
  • Joined: 13-March 08

Re: How to display a image in message box

Posted 27 January 2009 - 08:29 AM

Oops, sorry , i made a mistake,
i think it will be solved if you replaced "Dialog1" with "Form2" or what ever was the name of the second form
good luck, i hope this helps.☺
Was This Post Helpful? 0
  • +
  • -

#13 mechsoft_developer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 21-January 09

Re: How to display a image in message box

Posted 27 January 2009 - 08:36 AM

View Postnarmer93, on 27 Jan, 2009 - 07:29 AM, said:

Oops, sorry , i made a mistake,
i think it will be solved if you replaced "Dialog1" with "Form2" or what ever was the name of the second form
good luck, i hope this helps.☺


Still same problem since i donot know how to declare a form in another form
Was This Post Helpful? 0
  • +
  • -

#14 narmer93  Icon User is offline

  • D.I.C Regular

Reputation: 8
  • View blog
  • Posts: 317
  • Joined: 13-March 08

Re: How to display a image in message box

Posted 27 January 2009 - 08:52 AM

Did you add the second form or not yet?if not project ►add new item ► add windows form(it will have the name form2
then add a label and a picbox in it and try the code again)
and in my code ,use form2 instead of dialog1 i guess it should work fine
Was This Post Helpful? 0
  • +
  • -

#15 mechsoft_developer  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 12
  • Joined: 21-January 09

Re: How to display a image in message box

Posted 27 January 2009 - 09:04 AM

View Postnarmer93, on 27 Jan, 2009 - 07:52 AM, said:

Did you add the second form or not yet?if not project ►add new item ► add windows form(it will have the name form2
then add a label and a picbox in it and try the code again)
and in my code ,use form2 instead of dialog1 i guess it should work fine


Thank you very much Its working ! I have managed to declare the form like 'Dim frmForm2 As Form2 = New Form2()'

and it wrked

Thank you very much for your help again. I have another issue with my code ...it is running into infinite loop but the code looks ok...can you chck i will send you both form and code which will give you an idea
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2