|
I created a class inherited from TextBox and to add it into my forms I just added Windows TextBox objects then modified the code created by VS by modifying the type to my own textbox class.
This worked fine for a while; however, all of sudded all my controls dissapeared. This must have happened because I emptied the folder that contained my custom TextBox.
So to prevent this from happening in the future, what is the right way of adding custom controls to windows forms so it doesn't wipe them out automatically?
I also have some classes inherited from "System.Windows.Forms.UserControl" and the same problem happened a while ago, so before I start creating a form with a whole bunch of my custom controls I would rather figure out how to add them the right way to prevent them from disappearing.
Please don't tell me I have to add my controls to the GAC. That would be a pain. Reason is that a while ago I added some dll's to the GAC and when I wanted to step through my code, it wouldn't step in and I couldn't figure out the reason. Finally I removed my dll from GAC and then I could go in debug mode. Maybe I did something wrong here as well, so please feel free to comment.
|
|
|
|
|
Hi;
To add your custom control on to the toolbox in VS do the following steps:
1: Create a directory somewhere on your system where you will place your custom control dll's in. Do not delete this directory or it contents. If you do the controls will not show up in your Toolbox or any forms you put them on VS.Net.
2: Go to the Toolbox and select the tab you want the control to show up on, or create a new tab by right clicking on the Toolbox and select Add Tab from the menu and fill in the tab name at the bottom of the Toolbox and press enter key. Then click on the tab.
3: Right click on the Toolbox and select Add/Remove Toolbox Items...
4: In the Customize Toolbox dialog make sure that the .Net Framework Components tab is selected and then click on the Browse... button.
5: Now navigate to the directory you created in step 1 and double click on the custom control dll you want to add.
6: Your control should now have a check mark next to it and its version number at the bottom of the page. click the OK button.
Now any time you need your control just go to the toolbox and drag it on to the form.
I hope this has been of some help.
-Fernando Soto
|
|
|
|
|
Thanks, your detailed steps sure help.
|
|
|
|
|
Hi,
I have just installed MS SQL 2005 Express for testing purpose but a unabe t gn.. what user id and passwrd should use?
Many Thanks,
Jassim Rahma
|
|
|
|
|
I don't know, but if you didn't provide a password on installation, try user name sa and leave the password blank, you probably will get in.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
Hi All,
I have a problem which is driving me barmy. I am writing a VS.NET integration package which refereces a API which contains a data layer and a web control layer. When the package is loaded by the studio and I attempt to invoke a form from UITypeEditor.EditValue on a property in a web control in design mode I can not cast the value parameter (which is a type from the API) from 'object' to its correct type, the layout below might help:
1) Package Directory:
API Assembly
Package Assembly
2) VS.NET ID Directory
API Assembly (needs to be here so the property grid can load it)
3) Web Project Running in design mode with the package loaded has a reference to the API Assembly (from the IDE Folder)
In UITypeEditor.EditValue I am doing this:
Criteria c1 = (Criteria)value; // Specified Cast is not valid (also if(value is Criteria) fails)
Criteria c2 = new Criteria();
In debug, the watch reveals the the 'value' object is infact a Criteria object, however they are loaded from two different assemblys. The versions are identical, but the locations are different:
The Location for 'value' comes from a temporary projects assembly folder (more than likely created and managed by visual studio), however 'c2' is coming from the API Assembly in the VS.NET Directory. This is probably because the call is within the context of the vs.net property grid which has loaded its dll from there.
Now, I am hoping there is a correct method of getting around this!
Regards, James Simpson
James Simpson
Web Developer
imebgo@hotmail.com
P S - This is what part of the alphabet would look like if Q and R were eliminated Mitch Hedberg
|
|
|
|
|
This may lead you in totally the wrong direction, but what if you were to specify your own assembly resolver using AppDomain.CurrentDomain.AssemblyResolve?
Does this allow you to specify where to load the assembly when using the designer?
As I said, beware of wild goose chases with regards to my suggestion.
Marc
MyXaml
Advanced Unit Testing
YAPO
|
|
|
|
|
Thank You Marc,
That was successful. I removed the DLL's from the IDE directory and handled the AssemblyResolve function in the package, returned the correct assembly and the value casts as it should.
Cheers!
James
James Simpson
Web Developer
imebgo@hotmail.com
P S - This is what part of the alphabet would look like if Q and R were eliminated Mitch Hedberg
|
|
|
|
|
I was looking through some dll's using dependancy Walker and alot of them are pointing toward a Watchdog.sys file. Looking through this file I see alot of monitoring and event functions.
What exactly does this file monitor?
And is there a way to interop into it from C#?
Thanks
Steve
Steve Welborn
Software Architect
|
|
|
|
|
I have been developing a Soap messaging application. I created a message handler class which was derived from from the SoapReciever class. I created a node by putting the class in my web server and added it to the web config file under httpHandlers. I can send soap messages and the recieving end is intended to write the messages to an XML file, the code is correct however in the end there is no file.
Does anyone know what I should do?
|
|
|
|
|
Hi , C# Fellows,
I am writting a program to deal with C++ Dll.
When I do stress testing , (run the program continously), at the end I got "Out of Memory" Exception , So I am thinking of adding some code to monitor memory change. But the prolem here is , I dont know when the Garbage Collector will kick in. So , Its critical to catch this event.How Can I do it in C#--???
Thanks
|
|
|
|
|
Is there something wrong with using the Performance Monitor built into Windows?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Well, stress testgin will last for a quite long time , and I can't stay there stare at it whole day.
|
|
|
|
|
It can log the data to a Perofmrnace log file. But since, in your other post, you said that you want to log what looks like every function call, Performance Monitor won't help you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
|
hi, Leppie,
I make it clearer:
what I want is a record something like this:
time:- 8:12:21, Event : function ..called,free memory size: ..Bytes
time:-8:12:23, Event : GC called ., free memory size : ..Bytes;
so later on we can determine which function does have memory leak.
and ,Yes , some Dll call locate memory and release later.
|
|
|
|
|
Technically I don't think it is ever specified when the GC happens (no behavior in the ECMA is specified for this?) and technically you as a .Net Framework programmer shouldn't care. There is no real concept of "memory" in a virtual machine like the .Net Framework. An object holds a "reference" not a memory address. Memory is treated just like other resources (file handles, sockets, etc). The virtual machine can either allocate the resources necessary to vivify (is that the right word? ) the object or it fails and hopefully throws an exception that is meaningful.
So from what I read you want C# code that knows when it can't create any more objects. This is inherently hard to do in a virtual machine system like the .Net Framework because all of the innards are virtual! In general the .Net Framework will not tell you before hand whether you can create the object before you create it. You can gather some information about the external OS and try to make a judgement then but I haven't found a .Net Framework facility to check if it will succeed making the next object beyond trying to make the next object.
ps. Since it sounds like you are dealing with a DLL written in C/C++, maybe you are leaking memory because you aren't handling allocation correctly? If you fix that you don't need to worry about trying to monitor memory usage.
|
|
|
|
|
You can use the CLR Profiler[^] to get this type of information, or if it doesn't work for you, you can write your own profiler that ties into the .net profiler api to get that information.
I can imagine the sinking feeling one would have after ordering my book,
only to find a laughably ridiculous theory with demented logic once the book arrives - Mark McCutcheon
|
|
|
|
|
Is there any utility which converts VC++ code to C# code. I do not expect all conversions basic conversion will do such as class, property, method migration.
Thanks
Shyam
|
|
|
|
|
I don't see how it could exist. Unless you were talking about converting Managed C++ code to C#. But unmanaged code to C#? I don't see how it could possibly work. Just mapping the MCF classes and code to .NET Framework classes would be nightmare.
You can check out this[^] discussion of the very topic on a MSDN Blog.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
OK, what is wrong with this property definition in a control? In the properties list the little empty box displays next to the name and the dot-dot-dot button works correctly, but when I select a file nothing is every filled-in and the resource is not serialized in the InitializeComponent() call. I suspect it is a serialization issue but I have tried both Visible and Content to no effect.
[
CategoryAttribute("Appearance"),
DescriptionAttribute("Image that appears when control is down."),
BrowsableAttribute(true),
EditorAttribute("System.Drawing.Design.ImageEditor, System.Design",typeof(UITypeEditor)), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),
TypeConverter(typeof(System.Drawing.Bitmap)),
DefaultValueAttribute(null)
]
public Bitmap ImageDown
{
get
{
return null;
}
set
{
_imageDown = (Bitmap)value;
}
}
|
|
|
|
|
No wonder your Bitmap is empty - you always return null...
I guess changing
get
{
return null;
} into
get
{
return _imageDown;
} could do the trick.
Regards,
mav
|
|
|
|
|
i read email from email server using pop3 classes,but for attachment its giving MissingBoundary Exception
if anybody know sen solution on my gmail account
rehman.azizur@gmail.com
|
|
|
|
|
Hello
I am Atif. I am working to develope an application that extract text from viedo file if any one have idea about it please let me known how can do this .
Thanks
|
|
|
|
|
hello.
i am trying to creat a server/clients application and i want the server to hold an object and the clients to recive references to that object. (so far easy)
but i also want to do databinding on some of the propertyes so when someone changes a property the other clients will see the change live...
i tryed treating the remote object as an ordnary object and creat databinding but it didnt work..
is it even posible?
can any one here give me an example of how to do it?
|
|
|
|