How to use MsgBox Exclamation Point Yellow Triangle Image on form
-
Friday, July 22, 2011 12:52 PM
Everyone knows of the yellow triangle with a exclamation point in it on a message box. I would like to use that same image on one of my forms. Is this possible? If so, how do I do it?
Thanks, Ryan
Ryan
All Replies
-
Friday, July 22, 2011 1:04 PM
Hi,
Press the PrintScreen button to copy such a MessageBox to your clipboard.
Cut out the triangle in Microsoft PAINT or a similar program. :-)
If you don't want to do that get it here:>>
http://i13.photobucket.com/albums/a272/u-might-want-this/WarningTriangle.jpg
or right-click on this and select Save image as...:>>

Hope this helps. :-)
The above image will probably have a white background and not a transparent one.
Put it in your Pictures folder then:>>
Option Strict On Option Explicit On Option Infer Off Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.BackgroundImage = Image.FromFile(My.Computer.FileSystem.SpecialDirectories.MyPictures & "\WarningTriangle.jpg") Me.BackgroundImageLayout = ImageLayout.Center 'or:>> ' Me.BackgroundImageLayout = ImageLayout.Stretch 'or:>> ' Me.BackgroundImageLayout = ImageLayout.Tile 'or:>> ' Me.BackgroundImageLayout = ImageLayout.Zoom End Sub End Class
Regards,
John
Click this link to see how to insert a picture into a forum post.
Installing VB6 on Windows 7
XNA is coming to VB.Net
App Hub forums
-
Friday, July 22, 2011 1:22 PM
There's no way to access the windows image by code? That way I don't have to do a hack job. If not, I think I would prefer to import the image into a picture box at design time. But when I put a picture box on my form and import the image it doesn't show. Any ideas?
Ryan
Ryan -
Friday, July 22, 2011 2:07 PM
There's no way to access the windows image by code? That way I don't have to do a hack job. If not, I think I would prefer to import the image into a picture box at design time. But when I put a picture box on my form and import the image it doesn't show. Any ideas?
Ryan
RyanHi,
Sorry, not sure about accessing that image via code.
Have you tried? >>
PictureBox21.Image = Image.FromFile("C:\SomeImage.jpg")
'or
PictureBox21.BackGroundImage = Image.FromFile("C:\SomeImage.jpg")
Replace "C:\SomeImage.jpg"
with the full path and filename to your required image.
Regards,
John
Click this link to see how to insert a picture into a forum post.
Installing VB6 on Windows 7
XNA is coming to VB.Net
App Hub forums
-
Saturday, July 23, 2011 4:58 PM
There's no way to access the windows image by code? That way I don't have to do a hack job. If not, I think I would prefer to import the image into a picture box at design time. But when I put a picture box on my form and import the image it doesn't show. Any ideas?
Ryan
Ryan
You can access those messagebox icons through SystemIcons like below.'For Icon Dim ExclamationIcon As Icon = SystemIcons.Exclamation 'To use it as image Dim ExaclamationAsImage As Bitamp = SystemIcons.Exclamation.ToBitmap
kaymafkaymaf
CODE CONVERTER SITE
http://www.carlosag.net/Tools/CodeTranslator/.
http://www.developerfusion.com/tools/convert/csharp-to-vb/.
-
Saturday, July 23, 2011 9:27 PM
@Kaymaf: I'm ashamed to say that I never knew about the SystemIcons class. I've always added the images to my project's resources and referenced them that way. Just goes to show that the .NET framework always has something more to find.
Thanks.
-
Saturday, July 23, 2011 10:48 PM
@Kaymaf: I'm ashamed to say that I never knew about the SystemIcons class. I've always added the images to my project's resources and referenced them that way. Just goes to show that the .NET framework always has something more to find.
Thanks.
You don't have to be ashamed of anything you don't know that exists in .net framework. The framework is too broad for individual developer or programmer to have knowledge of everything that exists in .net planet.
kaymaf
CODE CONVERTER SITE
-
Sunday, July 24, 2011 5:18 PM
Thanks for the reply Kaymaf,
I am new to VB.Net. How do I get this icon on my form? I see that you are declaring it as a variable. Ideally, I would like to put the exclamation icon on my form at design time, but I'm guessing that's not possible? If I must do it by code, then how would I do that? Would I have to set up a picture box at design time... then what?
Thanks,
Ryan
Ryan -
Sunday, July 24, 2011 5:57 PM
Thanks for the reply Kaymaf,
I am new to VB.Net. How do I get this icon on my form? I see that you are declaring it as a variable. Ideally, I would like to put the exclamation icon on my form at design time, but I'm guessing that's not possible? If I must do it by code, then how would I do that? Would I have to set up a picture box at design time... then what?
I was reluctant to answer because Kaymaf deserves all the credit here! But yes, just add a picturebox and control it in code:
PictureBox1.SizeMode = PictureBoxSizeMode.CenterImage PictureBox1.Image = SystemIcons.Exclamation.ToBitmap
- Marked As Answer by Ryan0827 Monday, July 25, 2011 2:25 PM

