Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Window Form Location vb.net2005

Window Form Location vb.net2005

Scheduled Pinned Locked Moved Visual Basic
csharphelp
6 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aransiola
    wrote on last edited by
    #1

    I have a MDI WIndow with treeview on the left,listview on the right with a splitter separating them I want to open my other forms at a particular cordinate but its not working. i did something like this dim myForm as New Invoice myForm.left = listview.left myForm.top=listview.top myForm.show the form wasnt positioned at where iwant it to be pls help t.aransiola

    D T 2 Replies Last reply
    0
    • A aransiola

      I have a MDI WIndow with treeview on the left,listview on the right with a splitter separating them I want to open my other forms at a particular cordinate but its not working. i did something like this dim myForm as New Invoice myForm.left = listview.left myForm.top=listview.top myForm.show the form wasnt positioned at where iwant it to be pls help t.aransiola

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      You used the coordinates of the listview, which are relative to it's parent container, not the screen. So, the form being contained by nothing, used the coordinates relative to the desktop, not a window in your application.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007

      A 1 Reply Last reply
      0
      • A aransiola

        I have a MDI WIndow with treeview on the left,listview on the right with a splitter separating them I want to open my other forms at a particular cordinate but its not working. i did something like this dim myForm as New Invoice myForm.left = listview.left myForm.top=listview.top myForm.show the form wasnt positioned at where iwant it to be pls help t.aransiola

        T Offline
        T Offline
        Tom Deketelaere
        wrote on last edited by
        #3

        I ran into something simular last year and I think the problem was that you have to 'show' the form before setting the borders:

        aransiola wrote:

        dim myForm as New Invoice myForm.show myForm.left = listview.left myForm.top=listview.top

        If my help was helpfull let me know, if not let me know why. The only way we learn is by making mistakes.

        A 1 Reply Last reply
        0
        • D Dave Kreskowiak

          You used the coordinates of the listview, which are relative to it's parent container, not the screen. So, the form being contained by nothing, used the coordinates relative to the desktop, not a window in your application.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          A Offline
          A Offline
          aransiola
          wrote on last edited by
          #4

          pls assist with code snippet. The listview is on Mdimain window. Now i want the other windows cordinattes to be using the listview cordinates how do i get an object's reference cordinates in vb.net t.aransiola

          D 1 Reply Last reply
          0
          • A aransiola

            pls assist with code snippet. The listview is on Mdimain window. Now i want the other windows cordinattes to be using the listview cordinates how do i get an object's reference cordinates in vb.net t.aransiola

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #5

            aransiola wrote:

            The listview is on Mdimain window. Now i want the other windows cordinattes to be using the listview cordinates

            Since you haven't said anything about the parent container for this second form, I'm assuming you're not setting a parent window for the form. All you have to do is map the location of the ListView to Screen coordinates and use that result as the location for the new form.

            Dim newLocation As Point = ListView1.PointToScreen(ListView1.Location)
            Dim newForm As New Form2()
            newForm.Location = newLocation
            

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007

            1 Reply Last reply
            0
            • T Tom Deketelaere

              I ran into something simular last year and I think the problem was that you have to 'show' the form before setting the borders:

              aransiola wrote:

              dim myForm as New Invoice myForm.show myForm.left = listview.left myForm.top=listview.top

              If my help was helpfull let me know, if not let me know why. The only way we learn is by making mistakes.

              A Offline
              A Offline
              aransiola
              wrote on last edited by
              #6

              The code as shown below worked for non-modal window form but did not position modal window forms. even setting the cordinates before showing the window form dim myForm as New Invoice myForm.show myForm.left = listview.left myForm.top=listview.top any further discoveries to positioning modal forms will be appreciated. thanks thank u t.aransiola

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups