You can just create a method that accepts a combobox as parameter. and then inside your method, just do the usual setting of the datasource to your combobox, just like what you are doing in your code. Im not sure though if your data source for your combo boxes will be the same. If it isn't, you might want to add parameters for your datasource, displaymember, and valuemember to your method.
I think that the answer that you are looking for is that you must
add anther class to your project, create a method within that class
using your curent code. You then re use this wherever you like by adding a reference to the new class
at the top of each form. have a look at what refactoring does.
Instances of the class can then be created and its methods etc can be used.
Make sense ?
is there any way how to prevent child process, created in C# code using Process class, to inharit parent process inharitable handles?
Some equivalent to API CreateProcess parameter bInheritHandles
Is it Possible to Call A Function Like This to add a link label to a particular form
public void AddLinklabel(string form,int top, int left, int width, int height,string Link)
LinkLabel linkLabel1 = new LinkLabel();
form.linkLabel1.Location = new System.Drawing.Point(top, left);
form.linkLabel1.Size = new System.Drawing.Size(width, height);
form.linkLabel1.AutoSize = true;
Why not convert your method into a generic method? BTW, please enclose code samples in pre blocks like this:
publicvoid AddLinkLabel<T>(T containingForm, int top, int left, int width, int height, string link) where T : Form
LinkLabel label = new LinkLabel();
label.Location = new System.Drawing.Point(top, left);
label.Size = new System.Drawing.Size(width, height);
Note that I've just typed this sample into this textbox, so there might be an error or two, you should be able to get the gist from this though.
I Called The Function Like This But There are lot of errors displaying Error 1 The type 'string' must be convertible to 'System.Windows.Forms.Form' in order to use it as parameter 'T' in the generic type or method 'WindowsApplication1.Form1.AddLinkLabel<T>(T, int, int, int, int, string)' C:\Documents and Settings\Agni\My Documents\Visual Studio 2005\Projects\WindowsApplication1\WindowsApplication1\Form1.cs 21 13 WindowsApplication1