Results 1 to 14 of 14

Thread: SplitterWidth Resetting at run time

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2012
    Posts
    304

    Question SplitterWidth Resetting at run time

    Hi there,

    When I add a SplitContainer the SplitterWidth is at 4 by default.

    I have changed this to 15, this shows correctly in my design view, but when I run the program it shows it as 4.

    Any help on this would be appreciated.

    Thank you.

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: SplitterWidth Resetting at run time

    Assuming you have no set this value back to 4 in code somewhere, I would guess maybe all you need to do is rebuild your project instead of just running it. It may be using cached compiled copies of your code that didn't update for some reason. I can confirm that setting it to a higher value like 15 does work at runtime over here.

  3. #3
    PowerPoster Jenner's Avatar
    Join Date
    Jan 2008
    Location
    Mentor, OH
    Posts
    3,712

    Re: SplitterWidth Resetting at run time

    It could be saving the value in your Settings, and then every time you re-launch your program, reading the value back, and thus resetting it to "4".
    Try forcing it to 15 somewhere in the Form_Load() event and see if it's still acting the same way.
    My CodeBank Submissions: TETRIS using VB.NET2010 and XNA4.0, Strong Encryption Class, Hardware ID Information Class, Generic .NET Data Provider Class, Lambda Function Example, Lat/Long to UTM Conversion Class, Audio Class using BASS.DLL

    Remember to RATE the people who helped you and mark your forum RESOLVED when you're done!

    "Two things are infinite: the universe and human stupidity; and I'm not sure about the universe. "
    - Albert Einstein

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    May 2012
    Posts
    304

    Re: SplitterWidth Resetting at run time

    Both thank you for your responses.

    I have built the solution again (F7) it states up to date.

    I have also added SplitterWidth = 15 to FormLoad, still no joy.

    Is this a qwerk like my DataGridView I had to put it in a panel and set the Panel font size to 10 for it to allow the DataGridView column text to be size 10...

    This is all of my code:

    vb Code:
    1. Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    2.         arrangeForm("Home - Techdocs", 1, 0)
    3.         SplitContainer1.SplitterWidth = 15
    4.     End Sub
    5.  
    6.     Private Sub arrangeForm(title As String, colHide As Integer, colShow As Integer)
    7.         Me.Text = title
    8.         tlpMain.ColumnStyles(colHide).SizeType = SizeType.Percent
    9.         tlpMain.ColumnStyles(colHide).Width = 0
    10.  
    11.         tlpMain.ColumnStyles(colShow).SizeType = SizeType.Percent
    12.         tlpMain.ColumnStyles(colShow).Width = 100
    13.     End Sub
    14.  
    15.     Private Sub pbxLogo_Click(sender As Object, e As EventArgs) Handles pbxLogo.Click
    16.         arrangeForm("Home - Techdocs", 1, 0)
    17.     End Sub
    18.  
    19.     Private Sub lblCurrentProjects_Click(sender As Object, e As EventArgs) Handles lblCurrentProjects.Click
    20.         arrangeForm("Current Projects - Techdocs", 0, 1)
    21.     End Sub
    22.  
    23.     Private Sub lblArchivedProjects_Click(sender As Object, e As EventArgs) Handles lblArchivedProjects.Click
    24.         arrangeForm("Archived Projects - Techdocs", 0, 1)
    25.     End Sub

    Thank you.

  5. #5
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: SplitterWidth Resetting at run time

    If you start a new winforms project and just add a splitcontainer control with the splitterwidth set to 15, does it work then?

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    May 2012
    Posts
    304

    Re: SplitterWidth Resetting at run time

    Yes it does.

  7. #7
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,757

    Re: SplitterWidth Resetting at run time

    Click the splitter instance in your code somewhere (anywhere) and press ALT-F2 to show all of the references to it in your code. In the wondow that opens,look for where the Width is being set. You should find at least one that sets that value in the Designer file. If you are setting it elsewhere, you will see it as well in that window.
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    May 2012
    Posts
    304

    Re: SplitterWidth Resetting at run time

    Sorry what do you mean by clicking the splitter instance in my code?

    Also just so you know the splitter is within a TableLayoutPanel and also has Panels and TableLayoutPanels within it's panels. These are generally Docked to "Fill", don't know if or why this may cause some issues. It shows correct in the design window.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    May 2012
    Posts
    304

    Re: SplitterWidth Resetting at run time

    This is weird, now another Splitter on the same did change to 15 width. But I want it actually at 3. Now when I change it back to 3 it's stuck at 15.

    I have Built and Re-built project, but still has this issue.

  10. #10
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: SplitterWidth Resetting at run time

    Only other suggestion I have is to save your project and then close it. Navigate to the folder where your source code is, and delete the OBJ and BIN folders. Then open your project up and rebuild it. See if anything changes.

  11. #11

    Thread Starter
    Hyperactive Member
    Join Date
    May 2012
    Posts
    304

    Re: SplitterWidth Resetting at run time

    Nope :-( but thank you for your time and suggestions.

  12. #12
    Still learning kebo's Avatar
    Join Date
    Apr 2004
    Location
    Gardnerville,nv
    Posts
    3,757

    Re: SplitterWidth Resetting at run time

    Click the word "SplitContainer1" somewhere in code then press ALT-F2. That's what I mean by clicking an instance of it in code.
    Process control doesn't give you good quality, it gives you consistent quality.
    Good quality comes from consistently doing the right things.

    Vague general questions have vague general answers.
    A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.

    ______________________________
    Last edited by kebo : Now. Reason: superfluous typo's

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    May 2012
    Posts
    304

    Re: SplitterWidth Resetting at run time

    I'm not using any events for the splitcontainer so it's not in my code..?

  14. #14

    Thread Starter
    Hyperactive Member
    Join Date
    May 2012
    Posts
    304

    Re: SplitterWidth Resetting at run time

    Quote Originally Posted by Jenner View Post
    It could be saving the value in your Settings, and then every time you re-launch your program, reading the value back, and thus resetting it to "4".
    Try forcing it to 15 somewhere in the Form_Load() event and see if it's still acting the same way.
    Thank you all for your time, and suggestions.

    My original comment about it not changing back is because I had "SplitContainer1.SplitterWidth = 15" still in the form load, what a numpty my apologies.

    Anyway, it now works if I set the values within the form load for all of them, thank you.

    I've had a look in Form1.Designer.vb and it states they are setting to width 15. Why do I have to set this in the Form Load and the designer settings not working?

    Thank you.

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