Results 1 to 4 of 4

Thread: [RESOLVED] changing listview location at runtime

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2007
    Posts
    115

    Resolved [RESOLVED] changing listview location at runtime

    Code:
     
    frm2.ListView1.Location = New Point(0, 300)
    frm2.Refresh()
    MsgBox("loc: " & frm2.ListView1.Location.ToString)
    I get msgbox (x=0),(y=0)

    How come "y" doesn't change to 300?

    I wish to simply move the position of the listview.
    Last edited by jeffnyc; Jul 14th, 2007 at 01:52 PM.

  2. #2
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: changing listview location at runtime

    Is frm2 a created instance of a form, or is it the default instance?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Jun 2007
    Posts
    115

    Re: changing listview location at runtime

    I declare frm2 in a module as
    Code:
    Friend frm2 As Form2
    Then in a form1 I instantiate frm2 from a command button:
    Code:
     Private Sub btnStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStart.Click
            'loads display screen
            frm2 = New Form2()
            frm2.Show()
            frm2.startTimer()
        End Sub
    I've been able to change other properties of frm2 using this method from outside that form.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 2007
    Posts
    115

    Re: changing listview location at runtime

    Code:
    Me.ListView1.Location = New Point(100, 300)
    MsgBox("loc: " & Me.ListView1.Location.ToString)
    I even tried within form2 itself using the Me keyword. Same result.

    Update... think I resolved it. Had to with one of the other property settings such as alignment = snap to grid or dock = fill , not sure which but changed both and works =)
    Last edited by jeffnyc; Jul 14th, 2007 at 03:58 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width