473,406 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Fixed problem with ToolStrip items and PropertyBinding

PropertyBinding can be a great way to save user settings, but there is a
problem with using PropertyBinding on ToolStrip items. I've found a solution
to the problem and am sharing it here since I couldn't find a solution
anywhere on the web.

To recreate the problem:
Add a ToolStrip to a form. Add a TextBox to the ToolStrip. PropertyBind
the Text property of the TextBox (to do this, view the properties of the
TextBox, go to ApplicationSettings, on PropertyBinding, click the ... A list
of properties will show up. Next to the Text Property click the down arrow,
then click new. Type in TextData as the Name. Click OK, then Click OK again.

You will now see under PropertyBinding that the Text property is bound (You
can also tell this by the new little icon next to the Text property)

Run the app, enter in some text, close the app, then restart it. It should
have the text you entered but it doesn't. That's the problem.

Why does it do this? When you bind the property VS creates the entry in the
Settings.settings file, and creates the code to load the setting. What it
doesn't do is create the code to save the setting.

To add this code, go to the designer code (Have to click the Show All files
button to get to it) In the Dispose method, after the If statement, put in
the following code.

My.Settings.TextData = ToolStripTextBox1.Text

Now, when you start the app, enter data, close the app and then restart, the
text you entered will still be there.
Jul 12 '07 #1
0 1147

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Adam Honek | last post by:
I have a ToolStrip. The ToolStrip has a ToolStripDropDownButton with 3 ToolStripMenuItems My question is how do I catch the click event ot these 3 ToolStripMenuItems? I tried the below but...
2
by: Ludwig | last post by:
My application has a main tool strip menu (File, Options, help,...). There are also a number of context menu's that popup. Some main menu items should also be available in some context menu's. ...
4
by: gene kelley | last post by:
The default ToolStrip apparently renders an MS Office Style ToolStrip when the RenderMode is other than "System". When using a BackgroundImage in the ToolStrip, this Office Style border has rounded...
4
by: =?Utf-8?B?UmljaGFyZCBCeXNvdXRo?= | last post by:
Hi I'm trying to create a composite control to be used on a ToolStrip, consisting of a ToolStripComboBox and a ToolStripButton. It's going to be a control used to search for text in a grid...
2
by: Doc John | last post by:
After I've added the menustrip and the toolstrip to my MDI windows Form (and I've added their respective items), I notice that the items disappear. They're still in the code, but the association...
1
by: =?Utf-8?B?bGpsZXZlbmQy?= | last post by:
I've noticed that controls do not raise a Validating event if they are contained in a ToolStripDropDown via a ToolStripControlHost item. Please run the following sample and follow the instructions...
0
by: yashtech | last post by:
Hi There ia a default spacing between toolstrip items even though I've set the Padding and Margin properties of both toolstrip and toolstripbutton. How to remove that spacing? Thanks in advance....
1
by: Tom P. | last post by:
It's kind of hard to explain (so if you need more just ask) and any help would be greatly appreciated. I am writing a side-by-side file manager. On each side I have a DropDownButton that holds...
3
by: LukasMalik | last post by:
Hi, I have widely used ToolStrip in my application. I created a UserControl which contains this ToolStrip. I would rather like to use inheritance: MyCustomControl : ToolStrip Everything...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.