If I could help you then I'm glad to win a coder's heart :-D
AFSEKI
Posts
-
Generic parameter/reflection problem -
Generic parameter/reflection problemNo, you won't be creating a new Form each time. It was just an example, you can replace: pool.Add("myformid", new LoginForm()); pool.Add("myAboutformid", new AboutForm()); as pool.Add("myformid", myAlreadyCreatedLoginForm); pool.Add("myAboutformid", myAlreadyCreatedAboutForm()); also: GetForm(...) code I sent you does not create anything. Do you see any "new" keyword in the code/or am I blind? Result: - You have an assembly created in you bin\debug folder in which your Forms are also embedded. This is your store to create the Forms at run-time. You want to store some configuration related to your forms, so what you need is to store this configuration like size and location somewhere like an xml file. If you've done it(you've written Some basic data(location, position) can be retrieved from a file), then you want to get a Form from the pool. Then your pool is the one which is responsible of returning an instance of the Form type if there is already one, created in pre-call to GetForm(...) or you want to create a new instance with the configuration parameters stored using reflection. If this is what you want: // The configurtation of the Form you serialize/deserialize public class FormConfig : ConfigurationProperty /*or string, or xml file, or whatever you want */ { } public T GetForm(string form_id) where T: Form { if(pool.ContainsKey(form_id)) { return pool[form_id] as T; } else { // you may have a look at other overloaded method(s) of Activator.CreateInstance return Activator.CreateInstance(T, new object[]{GetConfig(typeof(mySerializedForm))}) as T; } } public FormConfig GetConfig(string key) { return ..... // return the deserialized config } public FormConfig GetConfig(Type key) { return ..... // return the deserialized config } "Peace at home, peace in the world" Mustafa Kemal Atatürk(the founder of the Republic of Turkey and its first President.))
-
unable to cast object of type 'X' to type 'X'check Type.IsAssignableFrom
-
Remove Duplicates in DatatableHave a look at DataColumn.Unique property.
-
Generic parameter/reflection problemDictionary pool = new Dictionary(10); pool.Add("myformid", new LoginForm()); pool.Add("myAboutformid", new AboutForm()); public class LoginForm : Form { } public class AboutForm : Form { } Type typLoginForm = typeof(LoginForm); LoginForm lf = GetForm("myformid"); lf.ShowDialog(); public T GetForm(string form_id) where T: Form { return pool[form_id] as T; } You can change the Dictionary to Dictionary> to add more than 1 item under the same key. Or Dictionary> to get a pool item with its type instead of form_id value which is string. Fire and Water, Love and Death, Sex and the City? :)
-
Form Closing Validation ProblemSend the piece of code. As i guess, your textboxes are empty when the use clicks close(X sign on to Form Titlebar) validation fails because you validate if the text entered in the textbox is empty or not, if empty fail the validation which vauses form to give focus to this textbox back instead of closing.
-
Scrolling background in C# Winform??In 2D Games with the tpye you want: 1) There is a screen size background image and you draw onto a part of this big background image and update(Invalidate) just that part so because the user does see only a small portion of the big background image, he thinks he is moving in some directions ;) 2) Have a look at Code4Fun web site, where you can find some tutorials on game development. Hope this helps...
-
article on purchasing systemHave a look at open source CRM projects at SourceForge .NET
-
Check if open is already openif( myForm != null && !myForm.Disposing && myForm.IsHandleCreated) return; else myForm.Show();
-
USB (removable) drives in listboxHave a look at: http://icsharpcode.net/OpenSource/SharpUSBLib/default.aspx
-
splashScreen, .exe and con class2- Create a new Setup and Deployment -> Setup Project from the File->New->Proect and create your folders, choose what to add into your folders. NOTE: Better if you use Sql Server Express Edition 2005 (free and better than MS Access)
-
Problem reading XMLIt seems you are new to XML, so I don't suggest using low-level code, there is a easy to use System.Configuration namespace out there in MSDN Library, have a look at it. 1) Create a custom ConfigurationSectionGroup called cardfile 2) Create a custom ConfigutaionSection called card number 3) Create a custom ConfigurationElementCollection to store your front(s) 4) Create a custom ConfigurationElement called front You can find all the source code examples for the steps 1->4 in MSDN library and in internet This is the link: ms-help://MS.VSCC.v80/MS.MSDN.v80/MS.NETDEVFX.v20.en/cpref4/html/T_System_Configuration_ConfigurationElement.htm OR Look for: 1) ConfigurationElemnt class in MSDN Library Index Tab filtered by Visual C# 2) Select "about ConfigurationElement class" and there you are ;) Hope this helps...
-
how to do online registrationCheckout Updater Application Block from Enterprise Library ( you can download it from Microsoft website ) Also, you can have a look at webservice development to create your webservice, log in, send the encrypted user registration info, decrypt it on web service side, validate, send the result back to your application. Or, can try .NET Remoting instead of web services.
-
How to Clear Grid view in C# [modified]gView.Rows.clear(); Hope this helps...
-
Trasparent panelChange the opacity value. If your Panel does not support Transparent background (try changing background color to transparent from the properties window ), then you should implement your custom panel using : this.SetStyle(ControlStyles.SupportsTransparentBackColor | Opaque, true); in your constructor. Then playing with the opacity value of your control, you can make it as much transparent as you want. Hope this helps...
-
load combobox from xml [modified]Do you know what you want? This is your post: Thanks for the info, i got the loading of the combobox working, i am not trying to figure out how to save the changes back to the xml file if the user changes the value. And now you are saying: yes I am trying to save back the user modified values. I'm updating a config file so when the program is shutdown the changed value is read the next time the program is run. Are you OK?
-
Dll reference problemIf you read my post completely not only 1 sentence of it you could see that I tell how a dll can be run. You are a very excited young boy he? ;)
-
load combobox from xml [modified]I know that you are not trying to save back the user modified values to the XML file. What I suggest using Convert is to give you the ability to store the datatype of the object(what ever you create) as a string value and then convert it to what you want. You may also write a custom type converter or implement iSerializable interface or add XmlAttributes to your fields for which you want to serialize.
-
DLL fileWhat do you mean with assembly info(Properties Folder)? Can you explain it clearly so that I can try help you ?
-
Reg: Reflection accessing private Memebers..It is not safe because you try to access methods at run time using "reflection". Use SecurityPermissionAttributes on your private methods for which you want to access. What is the reason behind accessing a private mthod. Do it public then. As a design rule, make things non-punlic if you don't neeed them or if you want to secure them. Have alook at .NET Reflector tool which disassembles any .NET assembly to it's original source code using reflection including of course the private ones. Which means you can access but this tool also shows how unsecure your private methods are. To call these methods, I've not tried actually but as I said, try to make them internal or private and add SecurityAttributes to ptotect. Hope this helps...