473,545 Members | 2,469 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Custom control is inserting its own code?

I'm creating a multi-column dropdown since there isn't one. My idea
is to override an Infragistics Combo and add the dropdown as a grid
object. So I create a basic override of the control. The first thing
I want the control to do is kill the default button and add a new one.
So in the initialization (New) area of the control I add the code to
do that:

Me.DropDownButt onDisplayStyle =
Infragistics.Wi n.ButtonDisplay Style.Never
Dim Button As New
Infragistics.Wi n.UltraWinEdito rs.EditorButton
Button.Key = "Drop"
Button.Visible = True
Button.Enabled = True
Button.Text = "..."
Me.ButtonsRight .Add(Button)

Fairly simple. I build that and load up a new project. I add the new
control in design view and run. I get an error saying "Key already
exists" (each button requires a unique key).

When I look at the "Form Designer Generated Code", it contains this:

EditorButton1.K ey = "Drop"
EditorButton1.T ext = "..."
Me.DropCombo2.B uttonsRight.Add (EditorButton1)

Why is this in my sample application? I added it to the new control's
initialization but it's added to the sample app code when the control
is dropped on the form. Why is the sample application trying to add
the button again? I would have thought the button would be created
ONCE when the control is created (which it is), not again when the
program is run. How do I stop it from adding this control code to the
sample app?

Thanks!

Nov 20 '05 #1
2 2765
Fred,

If you have the Infragistics controls why not just use the UltraCombo? It
is exactly what you have described.

-Sam Matzen
"Fred Flintstone" <id**********@n ospam.com> wrote in message
news:5v******** *************** *********@4ax.c om...
I'm creating a multi-column dropdown since there isn't one. My idea
is to override an Infragistics Combo and add the dropdown as a grid
object. So I create a basic override of the control. The first thing
I want the control to do is kill the default button and add a new one.
So in the initialization (New) area of the control I add the code to
do that:

Me.DropDownButt onDisplayStyle =
Infragistics.Wi n.ButtonDisplay Style.Never
Dim Button As New
Infragistics.Wi n.UltraWinEdito rs.EditorButton
Button.Key = "Drop"
Button.Visible = True
Button.Enabled = True
Button.Text = "..."
Me.ButtonsRight .Add(Button)

Fairly simple. I build that and load up a new project. I add the new
control in design view and run. I get an error saying "Key already
exists" (each button requires a unique key).

When I look at the "Form Designer Generated Code", it contains this:

EditorButton1.K ey = "Drop"
EditorButton1.T ext = "..."
Me.DropCombo2.B uttonsRight.Add (EditorButton1)

Why is this in my sample application? I added it to the new control's
initialization but it's added to the sample app code when the control
is dropped on the form. Why is the sample application trying to add
the button again? I would have thought the button would be created
ONCE when the control is created (which it is), not again when the
program is run. How do I stop it from adding this control code to the
sample app?

Thanks!

Nov 20 '05 #2
Because the UltraCombo and UltraComboEdito r require data binding.
I've been through this with Infragistics, they don't have AddItem
controls so I'm forced to butcher my own. ComponentOne has one but
they took our money, offered no support and ignored us. (Stay clear
of C1)

I'd like to know why a custom control copies, exactly, the code from
the control class's New function into the code of the application it's
being used in.

What if you wanted a combo control that was dropped pre-populated
with say, US states? You'd override a combo, add the population code
to the New function of the control class and build to get a DLL. When
you drop the combo on a sample application's form in design view,
it'll be populated with 50 states. Cool. But little do you know,
dropping that control copied the population code from the New method
of the control class to the 'do not modify' section of the sample app.
So when you RUN the sample with that combo on the form, you get 100
states. Once when the control is dropped (we want that) and then
again when the program is run (we don't). If the combo won't accept
duplicates (like unique button keys) you get an error.

Why is the literal code I've placed in control's New function, added
to the application it's being used in? The New code runs twice.

On Tue, 6 Jul 2004 09:58:05 -0500, "Samuel L Matzen" <sm*****@slm.co m>
wrote:
Fred,

If you have the Infragistics controls why not just use the UltraCombo? It
is exactly what you have described.

-Sam Matzen
"Fred Flintstone" <id**********@n ospam.com> wrote in message
news:5v******* *************** **********@4ax. com...
I'm creating a multi-column dropdown since there isn't one. My idea
is to override an Infragistics Combo and add the dropdown as a grid
object. So I create a basic override of the control. The first thing
I want the control to do is kill the default button and add a new one.
So in the initialization (New) area of the control I add the code to
do that:

Me.DropDownButt onDisplayStyle =
Infragistics.Wi n.ButtonDisplay Style.Never
Dim Button As New
Infragistics.Wi n.UltraWinEdito rs.EditorButton
Button.Key = "Drop"
Button.Visible = True
Button.Enabled = True
Button.Text = "..."
Me.ButtonsRight .Add(Button)

Fairly simple. I build that and load up a new project. I add the new
control in design view and run. I get an error saying "Key already
exists" (each button requires a unique key).

When I look at the "Form Designer Generated Code", it contains this:

EditorButton1.K ey = "Drop"
EditorButton1.T ext = "..."
Me.DropCombo2.B uttonsRight.Add (EditorButton1)

Why is this in my sample application? I added it to the new control's
initialization but it's added to the sample app code when the control
is dropped on the form. Why is the sample application trying to add
the button again? I would have thought the button would be created
ONCE when the control is created (which it is), not again when the
program is run. How do I stop it from adding this control code to the
sample app?

Thanks!


Nov 20 '05 #3

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

Similar topics

19
2958
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 provide an open TD with a DIV in it for the content of this formlet. (The DIV is for DHTML to hide and show the content) I've created a web page...
21
2071
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 string with comma delimited values. For example, if I were to render two text boxes. One with the Value Terry and the Other with the Value 'Burns'...
7
2975
by: Shimon Sim | last post by:
I have a custom composite control I have following property
2
1274
by: Leeor Chernov | last post by:
Hi I am using a <asp:Table> in a user control I created and in the loop of inserting another user control( a custom Calendar) to the TableCell by the code: TableCellObj.Controls.Add(myCustomUserControl) the table accepting this user control but do not render it , so in that way I dont see the control in the table..., I tried also another...
2
2568
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 good while and I'm getting really frustrated now! My problem is this - my custom controls periodically disappear from my
8
2379
by: Lee | last post by:
Hi all, I'm trying to programatically change the background color of lines of text and running into a few difficulties, anyone got any suggestions? my relevant code is as follows: public void colorLines() { //_Paint = false; //don't want to update while we are doing this //loop thru lines like addText() does
12
2579
by: raghav | last post by:
Hi I am working on ASP.NET 2.0. I am developing a website using Wizard control. Based on number of steps added, next, previous, finish buttons generate automatically. After running the application, these button work automatically, means we can go to next step, previous step by clicking on corresponding buttons. In my application I have 3...
1
11706
by: WebMatrix | last post by:
Hi, I started a new web application which so far has several grdiviews displaying data. I find myself reimplementing the same logic (copy/pasting really) in grid's event ItemDataBound and RowCreated and Sorting events to add certain effects. For example inserting sorting direction image to the column header. I want to create one custom...
15
6485
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 accept other controls. The control i drag drop on it becomes the child of my custom control's parent form and not the child of my custom control. Then...
0
7425
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7682
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7449
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7780
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6009
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5069
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3479
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3465
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1037
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.