Welcome to Dream.In.Code
Become a VB Expert!

Join 149,485 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,348 people online right now. Registration is fast and FREE... Join Now!




Message Box location in VB

 
Reply to this topicStart new topic

Message Box location in VB

r_i_t_z_69
29 Apr, 2007 - 11:55 PM
Post #1

New D.I.C Head
*

Joined: 29 Apr, 2007
Posts: 1


My Contributions
I have searched for this topic but find little help. In my program I have a Message Box (not MsgBox) line of code. Because the Message Box centers itself on the screen it is blocking a label that also has information that changes in it. Is there anyway I can set the location of the message box? Below is a portion of the code from my program that contains the Message Box. Thanks in advance for any advice!

CODE


Private Sub escapeB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles escapeB.Click
        Dim random1 As Integer
        Dim random2 As Integer
        Dim randomGenerator As New Random
        random1 = randomGenerator.Next(1, 6)
        random2 = randomGenerator.Next(1, 3)

        If random1 = 3 Then
            MessageBox.Show("You Have Escaped!!!!!", "Super Barrio Bros", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)


User is offlineProfile CardPM
+Quote Post

tody4me
RE: Message Box Location In VB
30 Apr, 2007 - 08:28 AM
Post #2

Only Jenny Craig makes thin clients...
Group Icon

Joined: 12 Apr, 2006
Posts: 1,349



Thanked: 5 times
Dream Kudos: 100
My Contributions
the 2nd overload of the messagebox object in .NET shows a variable expected called the IWin32Handler which is the window handler of the objec that you want to specify as the parent. Find out more information about it's use at msdn.microsoft.com, and do a search for the System.Windows.Forms.MessageBox object and it'll give you all the methods and variables and how to use them.
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Message Box Location In VB
30 Apr, 2007 - 08:29 AM
Post #3

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,302



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
As far as using a MessageBox the answer is no, you cannot control placement of a MessageBox.

That is not to say that you cannot create another form and use that as a custom messagebox to display your message to the user. Then you have absolute control over where it will show up on the screen.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/7/09 04:46PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month