473,386 Members | 1,693 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,386 software developers and data experts.

Add custom properties to controls at runtime

Hi,

I would like to add two or three custom properties to some textboxes
and comboboxes controls at runtime.

Any ideas on how to do this?

NeilSanner

Nov 21 '05 #1
3 3659
Neil,

At runtime is your textbox and your combobox an object, not a class.

You can only add properties to a class, so therefore you have first to make
your own combobox and textbox classes by inheriting the originals.

I hope this helps,

Cor

Nov 21 '05 #2
That's a great idea if I ever want to be able to edit the properties at
design time! Thanks!

I found a workaround for adding properties to a control at runtime
using the tag property and the HashTable object:

Dim ht As New Hashtable
ht.Add("Optional", True)
ht.Add("WhereInRegistry",_
"HKEY_CURRENT_USER\Software\MySoft\Settings\Paths\ \BitmapsFolder")
TextBox_Folder_Clients.Tag = ht
MsgBox(TextBox_Folder_Bitmaps.Tag("Optional").ToSt ring)
MsgBox(TextBox_Folder_Bitmaps.Tag("WhereInRegistry ").ToString)

It's almost as using a custom property!!

Cheers!
NeilSanner

Nov 21 '05 #3
Way better to do the clone method before storing into the t:

Instead of this: TextBox_Folder_Clients.Tag = ht
This: TextBox_Folder_Clients.Tag = ht.clone

NeilSanner

Nov 21 '05 #4

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

Similar topics

3
by: Eric Sabine | last post by:
I've created a custom control (ascx) which contains a tree view, a drop down list, and a listbox. The custom control is included in a web form and at runtime, won't compile (I get the...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
10
by: everett | last post by:
I am dynamically creating labels. I would like to be able to attach custom properties(?) to the labels so that I can query the property for the data in it later. Is this possible, and how do I...
0
by: James | last post by:
I have a composite custom control which is constructed of several other controls, such as command buttons, a listview etc. I have several controls which border the boundary of the container and have...
0
by: Jon | last post by:
Hi, I have a program that orders a series of custom controls within a panel that has Autoscroll turned on. At runtime I have to reorder the layout of the custom controls. For some reason,...
2
by: AMDRIT | last post by:
Hello everyone, I have created a custom component and one of its properties is a class object with it's own properties. During runtime, I can assign values to the class object properties just...
0
by: Jeremy Chapman | last post by:
I have included below virtually all the code to a control I'm trying to build. My issue is that an array list property in my control does not get persisted properly to the aspx page code in design...
11
by: Pete Kane | last post by:
Hi All, does anyone know how to add TabPages of ones own classes at design time ? ideally when adding a new TabControl it would contain tab pages of my own classes, I know you can achieve this with...
6
by: | last post by:
I have made some user controls with custom properties. I can set those properties on instances of my user controls, and I have programmed my user control to do useful visual things in response to...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.