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

Deleting Custom Controls Only To Put Them Back Again.

1. I have created my own class that inherits the textbox (called it
CyanFocusTextBox). I put in some code and some new properties. All
this works. I build the dll that contains this class successfully.

2. I add it to the user controls section of toolbox and it appears.

3. I add the new CyanFocusTextBoxes to the form and it all works.

4. The problem comes when I update the class CyanFocusTextBox in the
dll and rebuild it. These updates are not used by the
CyanFocusTextBoxes that I dropped on the form earlier. I have to
delete those and put them back. Is there anyway around this? It is a
lot of work to delete the controls and put them back.

5. My project and dll are all in the same solution and the build
order is my dll first then my form. I have even tried rebuilding the
whole solution.

Thanks.

Wayne
Nov 20 '05 #1
3 1254
Wayne,

I too have wrestled with the toolbox, and frankly, I
think the design sucks. Perhaps someone will have a
better solution to this problem than I do, but my
conclusion is to avoid using the toolbox unless absolutely
necessary; if a component is unlikly to change, or if it
can't be represented visually by a standard control.

What I would do in the case of your custom textbox is to
add a regular textbox to your form, then edit the sacred
form designer code section of the code by changing the
class that your control instantiates.

Thus:

Friend WithEvents txtMyTextbox As TextBox

Becomes:

Friend WithEvents txtMyTextbox As CyanFocusTextBox

And:

Me.txtMyTextBox = New TextBox

Becomes:

Me.txtMyTextBox = New CyanFocusTextBox

The form designer doesn't seem to mind - at least not for
me so far, and I have implemented this strategy throughout
a large application. While it is a work-around, it beats
playing the toolbox shuffle, or worse yet, going without
a visual design representation of a control.

I suspect Microsoft imagined a highly structured enterprise
development environment. Well, excuse me!

If I have to admit to a more seat-of-the-pants approach to
programming, so be it.

Randy
-----Original Message-----
1. I have created my own class that inherits the textbox (called itCyanFocusTextBox). I put in some code and some new properties. Allthis works. I build the dll that contains this class successfully.
2. I add it to the user controls section of toolbox and it appears.
3. I add the new CyanFocusTextBoxes to the form and it all works.
4. The problem comes when I update the class CyanFocusTextBox in thedll and rebuild it. These updates are not used by the
CyanFocusTextBoxes that I dropped on the form earlier. I have todelete those and put them back. Is there anyway around this? It is alot of work to delete the controls and put them back.

5. My project and dll are all in the same solution and the buildorder is my dll first then my form. I have even tried rebuilding thewhole solution.

Thanks.

Wayne
.

Nov 20 '05 #2
Randy,

Wow, I like your work around and I am not afraid of the sacred form
designer code.

We can't be the only two that have wrestled with this problem. There
has got to be a way to use the latest version of your class without
doing the toolbox shuffle or deleting controls and putting them back
or changing the designer code. Perhaps I am just beating my head
against the proverbial .net wall but I can't believe the game ends
like this.

Wayne
"Randy" <ra**********@comcast.net> wrote in message news:<0b****************************@phx.gbl>...
Wayne,

I too have wrestled with the toolbox, and frankly, I
think the design sucks. Perhaps someone will have a
better solution to this problem than I do, but my
conclusion is to avoid using the toolbox unless absolutely
necessary; if a component is unlikly to change, or if it
can't be represented visually by a standard control.

What I would do in the case of your custom textbox is to
add a regular textbox to your form, then edit the sacred
form designer code section of the code by changing the
class that your control instantiates.

Thus:

Friend WithEvents txtMyTextbox As TextBox

Becomes:

Friend WithEvents txtMyTextbox As CyanFocusTextBox

And:

Me.txtMyTextBox = New TextBox

Becomes:

Me.txtMyTextBox = New CyanFocusTextBox

The form designer doesn't seem to mind - at least not for
me so far, and I have implemented this strategy throughout
a large application. While it is a work-around, it beats
playing the toolbox shuffle, or worse yet, going without
a visual design representation of a control.

I suspect Microsoft imagined a highly structured enterprise
development environment. Well, excuse me!

If I have to admit to a more seat-of-the-pants approach to
programming, so be it.

Randy
-----Original Message-----
1. I have created my own class that inherits the textbox

(called it
CyanFocusTextBox). I put in some code and some new

properties. All
this works. I build the dll that contains this class

successfully.

2. I add it to the user controls section of toolbox and

it appears.

3. I add the new CyanFocusTextBoxes to the form and it

all works.

4. The problem comes when I update the class

CyanFocusTextBox in the
dll and rebuild it. These updates are not used by the
CyanFocusTextBoxes that I dropped on the form earlier. I

have to
delete those and put them back. Is there anyway around

this? It is a
lot of work to delete the controls and put them back.

5. My project and dll are all in the same solution and

the build
order is my dll first then my form. I have even tried

rebuilding the
whole solution.

Thanks.

Wayne
.

Nov 20 '05 #3
Randy,

Got it.

Here is the sequence that I have used.

1. First update your class, make modifications, add functionality ...

2. Build your class (Mine was CyanFocusTextBox). My class is in a
dll.

3. Then go and look at the form that has the controls that are based
upon the rebuilt class (CyanFocusTextBox). Make sure you look at the
form in design mode. There is a delay on my computer when I do this.
It appears to be rewriting the sacred designer form code.

4. Run the program. The updated functionality of your class is
available to all the controls that are based upon your class
(CyanFocusTextBox) on the form.

This means that I do not have to delete the controls that are based
upon CyanFocusTextBox and put them back. I do not have to play the
toolbox shuffle.

It works like I would hope it works.

Wayne

Wayne

"Randy" <ra**********@comcast.net> wrote in message news:<0b****************************@phx.gbl>...
Wayne,

I too have wrestled with the toolbox, and frankly, I
think the design sucks. Perhaps someone will have a
better solution to this problem than I do, but my
conclusion is to avoid using the toolbox unless absolutely
necessary; if a component is unlikly to change, or if it
can't be represented visually by a standard control.

What I would do in the case of your custom textbox is to
add a regular textbox to your form, then edit the sacred
form designer code section of the code by changing the
class that your control instantiates.

Thus:

Friend WithEvents txtMyTextbox As TextBox

Becomes:

Friend WithEvents txtMyTextbox As CyanFocusTextBox

And:

Me.txtMyTextBox = New TextBox

Becomes:

Me.txtMyTextBox = New CyanFocusTextBox

The form designer doesn't seem to mind - at least not for
me so far, and I have implemented this strategy throughout
a large application. While it is a work-around, it beats
playing the toolbox shuffle, or worse yet, going without
a visual design representation of a control.

I suspect Microsoft imagined a highly structured enterprise
development environment. Well, excuse me!

If I have to admit to a more seat-of-the-pants approach to
programming, so be it.

Randy
-----Original Message-----
1. I have created my own class that inherits the textbox

(called it
CyanFocusTextBox). I put in some code and some new

properties. All
this works. I build the dll that contains this class

successfully.

2. I add it to the user controls section of toolbox and

it appears.

3. I add the new CyanFocusTextBoxes to the form and it

all works.

4. The problem comes when I update the class

CyanFocusTextBox in the
dll and rebuild it. These updates are not used by the
CyanFocusTextBoxes that I dropped on the form earlier. I

have to
delete those and put them back. Is there anyway around

this? It is a
lot of work to delete the controls and put them back.

5. My project and dll are all in the same solution and

the build
order is my dll first then my form. I have even tried

rebuilding the
whole solution.

Thanks.

Wayne
.

Nov 20 '05 #4

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

Similar topics

3
by: Eric Hudson | last post by:
A quick rant and a question. Why does the designer in VS2003 delete code about custom components that it can't load? I've had large sections of forms disappear in the blink of an eye just...
19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
21
by: One Handed Man \( OHM - Terry Burns \) | last post by:
When using a custom control. In order to check and see if values have changed one has to implement the IPostBackDataCollection interface. The values returned for the control seem to be simply a...
6
by: Suzanne | last post by:
Hi all, I really hope someone out there can help me as I've been tearing my hair out on this one for a good while and I'm getting really frustrated now! My problem is this - my custom...
2
by: Suzanne | last post by:
Hi all, I'm reposting this message as I'm experiencing this problem more and more frequently : I really hope someone out there can help me as I've been tearing my hair out on this one for a...
19
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the...
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...
8
by: Radu | last post by:
Hi. I have an ASP control on my page: <asp:Calendar ID="calStart" ................ Etc </asp:Calendar> and I have a Custom Validator defined as <asp:CustomValidator
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
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:
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...

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.