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

Subcontrols

If I have a project with a component that is derived from a control, say
RichTextBox, I insert this control into a form by placing a standard
RichTextBox on the form, and then doing a find and replace within the code
file of the form, replacing System.Windows.Forms.RichTextBox with the name
of my custom RichTextBox-derived class.
Is this the correct way to do it?

If I then want the RichTextBox to contain another custom control, derived
from, say, a ListBox, I drag a standard ListBox onto the 'virtual'
(peach-colored) designer of the component and do a find and replace again in
the same way, this is because I want all the code to manipulate the custom
ListBox-derived control to be within the code of the RichTextBox-derived
control - but I can't get the ListBox to display* unless its container is
the actual main form itself, which means I have to have the code to
manipulate the custom ListBox-derived control in the form, which I don't
really want. Is there any way I can get the custom RichTextBox-derived
control to completely contain the custom ListBox-derived control?

* when I say it won't display, the Show() method doesn't fire an error, but
it just isn't visible, even if I call BringToFront().

Any ideas?
Nov 16 '05 #1
3 1404
Beeves,

I donno whether you have done this?

//add list box to richedit control
RichTextBox.Controls.Add(listBox);

This is the only thing i am able to figure out for not seeing the list box.

Shak.
"Beeeeeves" <beeeeeeeeev@ves> wrote in message
news:us*************@TK2MSFTNGP10.phx.gbl...
If I have a project with a component that is derived from a control, say
RichTextBox, I insert this control into a form by placing a standard
RichTextBox on the form, and then doing a find and replace within the code
file of the form, replacing System.Windows.Forms.RichTextBox with the name
of my custom RichTextBox-derived class.
Is this the correct way to do it?

If I then want the RichTextBox to contain another custom control, derived
from, say, a ListBox, I drag a standard ListBox onto the 'virtual'
(peach-colored) designer of the component and do a find and replace again in the same way, this is because I want all the code to manipulate the custom
ListBox-derived control to be within the code of the RichTextBox-derived
control - but I can't get the ListBox to display* unless its container is
the actual main form itself, which means I have to have the code to
manipulate the custom ListBox-derived control in the form, which I don't
really want. Is there any way I can get the custom RichTextBox-derived
control to completely contain the custom ListBox-derived control?

* when I say it won't display, the Show() method doesn't fire an error, but it just isn't visible, even if I call BringToFront().

Any ideas?

Nov 16 '05 #2
The toolbox is a bit weird in visual studio if you ask me. I prefer the
toolbox in VB6.

Other than customizing the toolbox and browsing to a built version of the
DLL, and then selecting the class from there, and adding it to your form,
your suggestion is the only other alternative.

In fact, if you're developing an EXE containing such inherited controls, I
think this is the only option.

Adding a usercontrol through the wizard does seem to register it in the
toolbox, but if you later change the name then it will no longer work... so
it's not the best solution.

"Beeeeeves" <beeeeeeeeev@ves> wrote in message
news:us*************@TK2MSFTNGP10.phx.gbl...
If I have a project with a component that is derived from a control, say
RichTextBox, I insert this control into a form by placing a standard
RichTextBox on the form, and then doing a find and replace within the code
file of the form, replacing System.Windows.Forms.RichTextBox with the name
of my custom RichTextBox-derived class.
Is this the correct way to do it?

If I then want the RichTextBox to contain another custom control, derived
from, say, a ListBox, I drag a standard ListBox onto the 'virtual'
(peach-colored) designer of the component and do a find and replace again in the same way, this is because I want all the code to manipulate the custom
ListBox-derived control to be within the code of the RichTextBox-derived
control - but I can't get the ListBox to display* unless its container is
the actual main form itself, which means I have to have the code to
manipulate the custom ListBox-derived control in the form, which I don't
really want. Is there any way I can get the custom RichTextBox-derived
control to completely contain the custom ListBox-derived control?

* when I say it won't display, the Show() method doesn't fire an error, but it just isn't visible, even if I call BringToFront().

Any ideas?

Nov 16 '05 #3
Sorry wrong thread :) Please ignore.

"John Wood" <sp**@isannoying.com> wrote in message
news:eT**************@TK2MSFTNGP10.phx.gbl...
The toolbox is a bit weird in visual studio if you ask me. I prefer the
toolbox in VB6.

Other than customizing the toolbox and browsing to a built version of the
DLL, and then selecting the class from there, and adding it to your form,
your suggestion is the only other alternative.

In fact, if you're developing an EXE containing such inherited controls, I
think this is the only option.

Adding a usercontrol through the wizard does seem to register it in the
toolbox, but if you later change the name then it will no longer work... so it's not the best solution.

"Beeeeeves" <beeeeeeeeev@ves> wrote in message
news:us*************@TK2MSFTNGP10.phx.gbl...
If I have a project with a component that is derived from a control, say
RichTextBox, I insert this control into a form by placing a standard
RichTextBox on the form, and then doing a find and replace within the code file of the form, replacing System.Windows.Forms.RichTextBox with the name of my custom RichTextBox-derived class.
Is this the correct way to do it?

If I then want the RichTextBox to contain another custom control, derived from, say, a ListBox, I drag a standard ListBox onto the 'virtual'
(peach-colored) designer of the component and do a find and replace again
in
the same way, this is because I want all the code to manipulate the

custom ListBox-derived control to be within the code of the RichTextBox-derived
control - but I can't get the ListBox to display* unless its container is the actual main form itself, which means I have to have the code to
manipulate the custom ListBox-derived control in the form, which I don't
really want. Is there any way I can get the custom RichTextBox-derived
control to completely contain the custom ListBox-derived control?

* when I say it won't display, the Show() method doesn't fire an error,

but
it just isn't visible, even if I call BringToFront().

Any ideas?


Nov 16 '05 #4

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

Similar topics

7
by: Martin Schulze | last post by:
Hello, i tried to compose myself a custom usercontrol which is derieved from System.Windows.Forms.UserControl. It contains 2 comboboxes and one textbox (which are also custom controls, but...
2
by: Robbie | last post by:
I have a Web Form with some tailored logos and artwork. The web form also has a user control that has typical registration info on it (Name, Company Name, etc.) One of the fields, a TextBox, is a...
2
by: Bonj | last post by:
When handling the datagrid's OnEditCommand handler, the DataGridCommandEventArgs has an Item property, which has a collection of controls. One of these contains three subcontrols, the middle one...
5
by: Mark Friedman | last post by:
Does anyone know how to reference a subcontrol of a UserControl within client-side script. For example, if I have a TextBox as one of the elements of my UserControl with an id of "MyTextBox", how...
2
by: jand187 | last post by:
Hi, I'm using ASP.Net 2.0 Beta 2. I have an asp:panel that works as a list. I have a button that adds an item to that list. When i click on the button I want a new item (UserControl ASCX) to...
2
by: Patrick McGuire | last post by:
I want to place a tabControl with almost identical properties on several forms. I think the best way is to define a UserControl that inherits System.Windows.Forms.TabControl, and place all my...
2
by: Rene Sørensen | last post by:
In VS 2005 I'm trying to create a usercontrol, but I have some problems with it right now I can't figure out how to fix. The size of my usercontrol is "Size 574; 619" I have anchored all controls...
4
by: Rolf Welskes | last post by:
Hello, the problem seems simple I have an own webcontrol one property is public bool IsEdit { get
3
by: Jeff | last post by:
Hey ASP.NET 2.0 Below you see the code I'm having problem with. In the Open_Message event/method I want to get the value of the HiddenField at the row in the repeater control I clicked.... my...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.