Form Startup Location

First time dealing with multiple forms

Page 1 of 1

2 Replies - 2694 Views - Last Post: 30 November 2010 - 05:22 PM Rate Topic: -----

#1 Viper2KX  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 99
  • Joined: 25-January 09

Form Startup Location

Posted 29 November 2010 - 10:32 AM

This is my first time working with multiple forms in a single solution and I am trying to get the secondary form (Dice Roller in image) to just show exactly how it looks.

This is the best I could think of for the code:
Private Sub DiceRollerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DiceRollerToolStripMenuItem.Click
        If Form2.Visible = False Then
            Form2.Show()
            'Form2.StartPosition = Right
        Else
            Form2.Hide()
        End If
 End Sub



Currently since I typed that code up, I started to get errors. :ohno:

Attached image(s)

  • Attached Image


Is This A Good Question/Topic? 0
  • +

Replies To: Form Startup Location

#2 Amrykid  Icon User is offline

  • 4+1=Moo
  • member icon

Reputation: 147
  • View blog
  • Posts: 1,589
  • Joined: 16-December 08

Re: Form Startup Location

Posted 29 November 2010 - 08:49 PM

Have you fully exited your program before trying to build it again?

To get the Form to show next to the Main Window, you need to take the Main Windows' X coordinate, add its Width, and that will be your Dice Roller's X coordinate.
Private Sub DiceRollerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DiceRollerToolStripMenuItem.Click
        If Form2.Visible = False Then
            Form2.Show()
            Form2.Location = New Point(Me.Location.X + Me.Width,Me.Location.Y)
        Else
            Form2.Hide()
        End If
 End Sub




Was This Post Helpful? 1
  • +
  • -

#3 Viper2KX  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 99
  • Joined: 25-January 09

Re: Form Startup Location

Posted 30 November 2010 - 05:22 PM

Thanks. It works.

And I just restarted after copying the code. I didn't have much GUI to deal with.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1