You can use "System.Activator.CreateInstance" method.....It has around 9 overloaded methods....I normally use the one in which you give the System.Type of the class you want to instantiate, but there is also a method in whihc you specify the name of the class (as string) and the assembly name (as string) in which this class exists. This method will be helpful to you
Or you can also use one of teh overloaded method of "System.Activator.CreateInstanceFrom"...which takes name of the file of the assembly and teh name of the class
You'll then have to typecast the returned object to the type of your class
I have following requirements to achieve: I have some images and I am adding them as a resource to a dll. This dll is then to be used for getting those images by the other clients.
Now to do so first I generated a .resx file which includes all these images in the xml form. Then I convernted .resx to .resource file using resgen.exe. After this I used al.exe to generate .resource.dll from .resource file using neutral culture. Once done, I implemented a .cs file which has all those public getter methods for interface for the clients. I then compiled it and attached the .resource.dll file I earlier made.
Now when I am using this dll in some client, I get a runtime error "An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Unknown Module."
I couldn't figure out whats wrong with it. Can some one help me out?
Satellite assemblies are different from primary assemblies, which contain modules. Satellite assemblies contain only resources and they do define a locale in the MANIFEST (a la AssemblyCultureAttribute).
The way things are named is also important. For example, if you put the neutral language resources in your primary assembly as MyStuff.resources, then the resources in the satellite assemblies must be MyStuff.de.resources (for culture-independent German - something I use quite a bit). The assembly itself must either be MyAssembly.de.dll and/or MyAssembly.dll in a "de" sub-directory.
Once you've got that down, you're on track putting the images in the ResX files (most likely using base64 encoding, which is a good idea for binary data). You can also serialize anything which has a TypeConverter associated with it that can convert to/from strings, like Location and Size properties.
To get a good feel of how all this ties together, try a localization sample using VS.NET. Create a form, set the Localized property to true and design your form using the neutral language, then switch to a new language and override whatever you want. Show hidden files on your project and take a look at them. VS.NET can help with a lot of these tasks, even if you don't use localization functionality provided by the designer (which I don't, because it localizes everything with the LocalizationAttribute set to true, which is quite a lot, making the code run pretty slowly). Finally, compile your example and look at the assembly output, including the MANIFEST for each which you can easily see using ildasm.exe from the .NET SDK).
One more thing: use the NeutralResourcesLanguageAttribute with the culture-specific language (ex: "en-US") so that the Fusion component of the .NET Framework doesn't go looking for your resources contained in your primary assembly, which takes a little extra time - which can be significant when you use touchless-deployment over the web like we're doing with our application.
I have a dialog box implemented in C# and I want to make it the child of the currently active window. For this I want to get the ref to the current windows. I couldn't find anyway so that I could get this ref as Windows.Form object.
One thing I tried was that I used user32.dll GetForegroundWindow() to get the handle to the currently active windows and then use NativeWindow.FromHandle(IntPtr ) method to get the current windows as NativeWindow ref. But in this case I get the handler to the current windiows but the FromHandle method return me always null.
Does anyone know of a way to get the currently active windows?
What I want is a bit different. My application runs in its own memory space and I want to associate it to an application with some differnt memory space. For instance, I have an open word document and I want to associate that word document to my dialog as parent.
You can't parent a dialog in one process to another in another process. This isn't possible. The most you can do is position it by getting the currently active window, getting it's position information, and then update your window's position (which should have Form.TopLevel set to true) so that it appears to be parented.
To get the foreground window, P/Invoke GetForegroundWindow (not GetActiveWindow, which gets the active window attached to the calling thread). You can then P/Invoke GetWindowRect using the IntPtr (representing the HWND) returned from GetForegroundWindow to get the coordinates of the foreground window and site your window accordingly.
I am sure there is a simple way to do this, but heck if I can figure it out tonight. Does anyone know of a way to float a child Form (say tool window) in an application properly?
I have a main Form, and I create a new child Form (tool window) with a parent of null and TopMost set to true. This allows my tool window to float over the app nicely. The problem is when I switch to another application, my toolwindow is still staring me in the face since it is TopMost!
How can I make it float topmost only when the application is active? Is there a way to distinguish between the application losing activation because the user switched to another app or because they clicked on the child tool window (which causes a deactivate)?
I have got a nice doubt to ASK
I have created a user control in C#.net.
and that control is also implementing few interfaces.
but the problem is that ,when i integrate this
control on to a windows form, we can see the user
control for sometime, or days but after few days or
so we can't see it at design time.But is there in the form
at run time. We are using visualstudio 6.0 sourcesafe and
and during integration process most form has got
more than 10 controls. I have mailed it to few discussion
forums but didnt got a satisfying reply.
I wish to know, if there is any way to send an image from one form to another using a socket conection. Say like one form can send an image to another form on a remote computer that recieves it and views it. Can it be done just using sockets? Thanks in advanced
Michael's suggestion is correct but you will also have to make sure that the client and server both send/receive the entire image. This means either putting a delimiter at the end of the image data or sending a 4 byte 'image data size' value before the image data. This is a basic socket principle so you don't not send or not receive the entire application level message.
Hello, i have this web browser application which uses the AxWebBrowser control. It works pretty well except that i doesn't support auto complete. e.g. when u double click on an empty textbox, it will display a list of previous entered values.
Does it need special coding to handle it or can it be just a simple turning on of certain option?
When pursuing your dreams, don't forget to enjoy your life...
First you create a new project
File > New >project >Setup and deployment > Setup. Just mentione the name and location where you want to keep your setup file.
Second Stage > Right now you are in FileSystem Window. Am i right ?
Ok. Here you can see Application Folder ,user's Desktop, User's Programs Menu some thing like this.
third stage > Choose add project from File Menu and choose existing project. After this you have to mention for which project file that you need to create setup file. Choose you project directroy.Choose the file
Just wait a second. After this stage right click the application folder and choose the option Add > Project Output.
Choose all in ProjectListBox except DebugOut Put And Source File. Then choose Cofiguration Tab and select Active.
then click ok.
You will get some file in the second Splited window of FileSystem Window.
Here you can view the two part of FileSystem Window.One is FileSystem on Target Machine and the other window is Output files. Select the application folder and right click on the next window.You will get a popup window with an option add. Choose the Add and go for the File option.
Here you can choose all aditional resouces file that you are going to use in your project.eg. icon's, configuration file etc.
Choose the all required files holding ctl key and add it. Here you got some more file right. Ok.
Next thing is if you want to give short cut to your project, then right click on the file
Primary output from xxxx(Active) and choose create shot cut. Now u will get one more file and rename it to what ever you want.
Choose the property of that shortcut and choose the Icon and browse in application folder. In application forlder you will get your project icon.
And create the project(build). If your project is error free then your effort will always successfull.
hai, feel free to contact
Sreejith SS Nair
Last Visit: 31-Dec-99 19:00 Last Update: 8-Feb-23 11:28