I have created a control in C# and it works a treat, however, when I
drop the control into a C# Windows Forms application, it does a very
odd thing. It creates the control in design mode, but when I run the
application, the control is nowhere to be seen.
Looking at the form designer generated code in the InitializeComponent
function, it has not added the code to create a instance of my
control.
ie. this.MyControl= new MyControl();
it has however, created the code in InitializeComponent() to add it to
the form...
Other controls I have created work fine, it's just this one, so I
think there is something wrong with my control, but having been
tearing my hair out all morning, and trying everything I know (which
is not alot..), I am still no further down the road to solving
this....
PS. If I add the code to create a new instance, then it works, until I
change somehting on the form, it then disappears.
Anyone got any ideas? 2 1835
I'm surprised that you see it in design mode but not at runtime. If you see
it at design time, it must be adding it to the controls collection. You can
paste in the 'windows form designer' generated code, and point out which
control is the one you're having difficulty with?
--
John Wood
EMail: first name, dot, second name at priorganize.com
"Ralph Wiggum" <mg**********@hotmail.com> wrote in message
news:5f**************************@posting.google.c om... I have created a control in C# and it works a treat, however, when I drop the control into a C# Windows Forms application, it does a very odd thing. It creates the control in design mode, but when I run the application, the control is nowhere to be seen.
Looking at the form designer generated code in the InitializeComponent function, it has not added the code to create a instance of my control.
ie. this.MyControl= new MyControl();
it has however, created the code in InitializeComponent() to add it to the form...
Other controls I have created work fine, it's just this one, so I think there is something wrong with my control, but having been tearing my hair out all morning, and trying everything I know (which is not alot..), I am still no further down the road to solving this....
PS. If I add the code to create a new instance, then it works, until I change somehting on the form, it then disappears.
Anyone got any ideas?
"John Wood" <sp**@isannoying.com> wrote in message news:<#b*************@tk2msftngp13.phx.gbl>... I'm surprised that you see it in design mode but not at runtime. If you see it at design time, it must be adding it to the controls collection. You can paste in the 'windows form designer' generated code, and point out which control is the one you're having difficulty with?
-- John Wood EMail: first name, dot, second name at priorganize.com
I found out what the probelm was, it was a type converter that I wa
using in my controls class. I moved this into the class, around the
function that uses the typeconverter (rather than the whole class),
and it started working again correctly.
Still don't understand why.... This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: owen |
last post by:
Generally speaking, what does it mean when I see a "button" with red text
showing this message instead of the control I've dragged onto the web form
in Design View.? (But the page works fine at...
|
by: George Durzi |
last post by:
I have a simple user control with a text box and a submit button. When the
user enters some text into the textbox and clicks the submit button, a
record is created in the database.
I'm using...
|
by: Ravi Ambros Wallau |
last post by:
Hey guys:
What can I do when an "Error Creating Control" is displayed on the form
(instead of the control), and a tooltip indicating the error never is
displayed?
Is there some log, some hidden...
|
by: Buddy Ackerman |
last post by:
I created this class
Public Class HTMLFileInput : Inherits System.Web.UI.HtmlControls.HtmlInputFile
Public Property Data As String
Get
Return ViewState("HTMLFileInput.Data")
End Get
Set...
|
by: BradC |
last post by:
(VB.NET 2002, Windows app).
I'm going to be provided a two-letter string like "BV" or "TP" that
represents a location.
I then need to perform some actions on several form controls that have...
| |
by: J R M |
last post by:
I've developed a custom control (it's basically a drop-down list and
then a couple of textboxes to include meta-data for the selection) that
I'm embedding into another custom control (the idea is...
|
by: shapper |
last post by:
Hello,
I am creating a user control where an Asp.Net control is used. It can
be either a button, an image button or a label.
I am trying to "expose" the Asp.Net control properties and events...
|
by: jelle.huygen |
last post by:
Hello,
I have a problem in ASP.NET 2.0 with the viewstate of my dynamically
added user control. I have reproduced the problem with a very simple
user control and a very simple page.
On my...
|
by: rajendra |
last post by:
hi i am rajendra i am posting my first question to this group i have
doubt from last few days .i want to clear it
why we need user control and wher should we use it,and the execution
of the...
|
by: Jerry Spence1 |
last post by:
Can anyone point me in the right direction on how to set a license key when
creating a licensed control dynamically?
I have a licensed ActiveX component. Works fine when I put an instance on
the...
|
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,...
| |
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: 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: 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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |