gibbo1715

Hi All

I have a split container on my form, what i want it to do is remember where it was if my user changes its width, Im assuming i can save this in my user settings and then call it again on my form load event but do i do this on the mouse up event and what is the setting i need to save

e.g.

MyValue = SplitContainer1.Panel1.Width

thanks

Gibbo




Re: Visual Basic Express Edition split container question

js06

I can't give you all the answers but i can help get you started.

You need to select view all files in the solution explorer

Open the settings.settings file

In the name column - name it what you want Ex. - Split1width or whatever

I guess it would be a string type and user scope

the value would be what you want to go back to maybe 4 or whatever

now save and this will add to your my.settings and will be available in intellisense when you type code

What you can do from here is call it with code

maybe in the size changed event or i guess you would need it in the load event actually

Me.SplitContainer1.Width = My.Settings.SplitWidth

or try it with a button click to test it

I havent' tested it but i believe this will basically do it for you

Look at the card game starter kit files and you will see how they have some of this set up






Re: Visual Basic Express Edition split container question

js06

I think i was wrong about the type it probably needs to be an integer since it is a number value




Re: Visual Basic Express Edition split container question

js06

I forgot this part

If you want to save the existing size you would need to do something like this

My.Settings.Split1width = me.splitcontainer1.width.tostring

'Saves the values in the setting file to be used

My.Settings.Save()

This is the code you would maybe place in the size changed event

I guess since you want to save changes for each user you need to have settings items setup for many users

I can't help with that part, the only thing i can suggest is to maybe create settings items for each group. I noticed before that you said there would be user level groups.

Example if you had 4 user level groups then make 4 settings Panel1widthgroup1, Panel1widthgoup2, etc...

Anyway i hope this has helped






Re: Visual Basic Express Edition split container question

gibbo1715

thankyou for your replys,

i ve tried the following to save the split point

Code Snippet

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing

My.Settings.SplitWidth1 = Me.SplitContainer1.Panel1.Width.ToString

My.Settings.Save()

End Sub

And the following to call it again but it doesnt put the split point in the same place

Code Snippet
Me.SplitContainer1.SplitterDistance = My.Settings.SplitWidth1

Anyone got any ideas

thanks

Gibbo






Re: Visual Basic Express Edition split container question

js06

You may need

My.Settings.SplitWidth1 = Me.SplitContainer1.SplitterDistance

My.Settings.Save()

Instead of using the panel width since you are trying to get the splitter distance






Re: Visual Basic Express Edition split container question

js06

I just tried this code and it works

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

My.Settings.Split1width = Me.SplitContainer1.SplitterDistance

My.Settings.Save()

EndSub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Me.SplitContainer1.SplitterDistance = My.Settings.Split1width

End Sub

I have mine set as Split1width so just make sure you have it correct for yours

Name - Split1width

Type - Integer

Scope - User

Value - 35 (this is just a default setting)