By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,198 Members | 917 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,198 IT Pros & Developers. It's quick & easy.

Splitter control location

P: n/a
Hello!

My windows form has Splitter control on it, and I save splitter's last
X-location when user changes it like ...

Private Sub Splitter1_SplitterMoved(ByVal sender As Object, ByVal e As
System.Windows.Forms.SplitterEventArgs) Handles Splitter1.SplitterMoved
'// Saving new Splitter X-Location
oSettings.SaveSetting(Application.ProductName, Me.Name,
"SplitterLocationX", Splitter1.Location.X.ToString())
End Sub

.... and this is working fine so far.
But when user opens this form I want my application to set splitter
X-location to this saved position again, and I tried like this way ...

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Try
'// Retrieving last Splitter X-Location
Dim intX As Integer =
Convert.ToInt32(oSettings.GetSetting(Application.P roductName, Me.Name,
"SplitterLocationX", 160))
Splitter1.Location = New Point(intX, Splitter1.Location.Y)

Catch ex As Exception
MessageBox.Show(ex.Message, "Error (Form1.Load)",
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub

.... but it's not moving to this retrieved X-location value :( What wrong
with this?

Anyway 'intX'-integer variable contains correct saved value (160 is only
default value if 'intX'-integer variable is not saved yet).

--
Thanks in advance!

Mika
Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"Mika M" <mika.mahonen@nospam_kolumbus.fi> schrieb
Hello!

My windows form has Splitter control on it, and I save splitter's
last X-location when user changes it like ...


Save and restore the width of the control left to the splitter. The splitter
is docked, so it's position is determined by the size of the control(s) left
to it.
--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2

P: n/a
* "Mika M" <mika.mahonen@nospam_kolumbus.fi> scripsit:
My windows form has Splitter control on it, and I save splitter's last
X-location when user changes it like ...

Private Sub Splitter1_SplitterMoved(ByVal sender As Object, ByVal e As
System.Windows.Forms.SplitterEventArgs) Handles Splitter1.SplitterMoved
'// Saving new Splitter X-Location
oSettings.SaveSetting(Application.ProductName, Me.Name,
"SplitterLocationX", Splitter1.Location.X.ToString())
End Sub

... and this is working fine so far.
But when user opens this form I want my application to set splitter
X-location to this saved position again, and I tried like this way ...


Have a look at the splitter's 'SplitPosition' property!

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.