-
Aug 12th, 2016, 12:10 PM
#1
Thread Starter
Hyperactive Member
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.
-
Aug 12th, 2016, 01:27 PM
#2
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.
-
Aug 12th, 2016, 01:28 PM
#3
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.
-
Aug 12th, 2016, 01:35 PM
#4
Thread Starter
Hyperactive Member
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:
Private Sub frmMain_Load(sender As Object, e As EventArgs) Handles MyBase.Load arrangeForm("Home - Techdocs", 1, 0) SplitContainer1.SplitterWidth = 15 End Sub Private Sub arrangeForm(title As String, colHide As Integer, colShow As Integer) Me.Text = title tlpMain.ColumnStyles(colHide).SizeType = SizeType.Percent tlpMain.ColumnStyles(colHide).Width = 0 tlpMain.ColumnStyles(colShow).SizeType = SizeType.Percent tlpMain.ColumnStyles(colShow).Width = 100 End Sub Private Sub pbxLogo_Click(sender As Object, e As EventArgs) Handles pbxLogo.Click arrangeForm("Home - Techdocs", 1, 0) End Sub Private Sub lblCurrentProjects_Click(sender As Object, e As EventArgs) Handles lblCurrentProjects.Click arrangeForm("Current Projects - Techdocs", 0, 1) End Sub Private Sub lblArchivedProjects_Click(sender As Object, e As EventArgs) Handles lblArchivedProjects.Click arrangeForm("Archived Projects - Techdocs", 0, 1) End Sub
Thank you.
-
Aug 12th, 2016, 01:37 PM
#5
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?
-
Aug 12th, 2016, 01:51 PM
#6
Thread Starter
Hyperactive Member
Re: SplitterWidth Resetting at run time
-
Aug 12th, 2016, 01:54 PM
#7
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
-
Aug 12th, 2016, 02:03 PM
#8
Thread Starter
Hyperactive Member
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.
-
Aug 12th, 2016, 02:08 PM
#9
Thread Starter
Hyperactive Member
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.
-
Aug 12th, 2016, 02:10 PM
#10
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.
-
Aug 12th, 2016, 02:13 PM
#11
Thread Starter
Hyperactive Member
Re: SplitterWidth Resetting at run time
Nope :-( but thank you for your time and suggestions.
-
Aug 12th, 2016, 02:16 PM
#12
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
-
Aug 12th, 2016, 04:16 PM
#13
Thread Starter
Hyperactive Member
Re: SplitterWidth Resetting at run time
I'm not using any events for the splitcontainer so it's not in my code..?
-
Aug 13th, 2016, 05:38 AM
#14
Thread Starter
Hyperactive Member
Re: SplitterWidth Resetting at run time
Originally Posted by Jenner
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|