dcsimg
Results 1 to 3 of 3

Thread: how to prevent SplitContainer from changing durig Form_Load

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2007
    Posts
    44

    how to prevent SplitContainer from changing durig Form_Load

    I'm using a SplitContainer on a form. I save the SplitContainer1.SplitterDistance when I move the splitter

    Private Sub SplitContainer1_SplitterMoved(ByVal sender As Object, ByVal e As System.Windows.Forms.SplitterEventArgs) Handles SplitContainer1.SplitterMoved
    Dim INIAccess As New INIAccess
    Dim sPath As String

    TreeView1.Width = SplitContainer1.Panel1.Width
    ListView1.Width = SplitContainer1.Panel2.Width

    sPath = My.Application.Info.DirectoryPath & "\Interface.ini"

    INIAccess.INIWrite(sPath, "Load", "SplitterDistance", SplitContainer1.SplitterDistance.ToString)


    End Sub

    the problem is that this event occurs also when the form loads and then overwrites the value in the ini file.
    how can I check if the event occurs during form load to prevent accessing the ini file

    thanks

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,723

    Re: how to prevent SplitContainer from changing durig Form_Load

    1. Set a variable at the end of the Load event handler, test that variable in your SplitterMoved event handler.

    OR

    2. Remove the Handles clauase from your SplitterMoved event handler and attach it with an AddHandler statement at the end of the Load event handler.

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2007
    Posts
    44

    Re: how to prevent SplitContainer from changing durig Form_Load

    can you be more specific pls

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width