|
Hello My name is Guy .
I want to ask something maybe you can help me in C#.
I want to pass some Controllers & Buttons I build in Windows.Form , in to a method that can made them Enable & change there Background perhaps.
.
Any way what I Tryed all night is how to pass a Control / Button / Object to a method without ( Object Sender... , Event...) ,in to other function.
I want to take the Control object for example and send his name property trough string to a function and then to cast him into Object type or Basetype.
Something like :
this.TurnControlActive( UrlFile.Name ); // * UrlFile =// System.Windows.Forms.Control *//
and then pass in to ....
private void TurnControlActive( ....... )
{
// Here the Control / Object need to become Enabled //
}
Who to pass an Object / Control / Or how to retrieve a Control by his string name ..?
Thank a lot.
Guy D.
By the way how do I get all my controls in my form into Array ?
|
|
|
|
|
Form parent = Form1.ActiveForm;
foreach (Control c in parent.Controls)
{
c.Enabled = true;
c.BackColor = System.Drawing.Color.Blue;
c.Show();
}
I've try this eiter but it's give me only one control and I've got alot of Button and ComboBox in my Form .
Any suggestions ?
|
|
|
|
|
If the controls are contained in another control (e.g. a panel) then you must also iterate that control's Controls list:
foreach (Control c in parent.Controls)
{
DoControls(c);
}
void DoControls (Control c)
{
c.Enabled = true;
c.BackColor = Color.Blue;
c.Show()
if(c.Controls.Count > 0)
{
foreach( Control cc in c.Controls)
{
DoControls(cc);
}
}
}
|
|
|
|
|
Wow Rob it was brilliant;
Can I get your email ?
|
|
|
|
|
hi friends..
How to fire text changed event for combobox.
|
|
|
|
|
Have you tried changing the text in the ComboBox??
Seriously, why are you trying to fire this event? Why not just call it's method with a couple of faked parameters?
|
|
|
|
|
When i try to find a regular expression in a string, if the expression isn't in the string the program just gets stuck =\
how can i fix it?
example:
<br />
Match find = Regex.Match(downloadPageSource, @"(\w?\d?)+\.site\.com/access(\d+)\.jpg");<br />
if the expression isn't there the program just freezes =\
|
|
|
|
|
I have some images. I want to construct an avi file using these images. Is it possible to do it using C#.
Anyone please help me. I am badly in need of a quick solution.
Thanks in advance
Enamul Hoque
|
|
|
|
|
Hi All, i has a solution with many projects inside, on of the projects is windows application and the other is windows class lib.
i want from the windows application project create an object of the class lib. and from the class lib. call methods in the windows application, i add the class lib. project as ref. to the windows application to make the object but how to call methods in the windows application from the class lib.??
|
|
|
|
|
We can do this with the help of delegates.
Regards,
Arun Kumar.A
|
|
|
|
|
Try this:
<code>
class lib
{
public delegate void myDel();
public myDel objDel;
public void Execute()
{
if (objDel != null)
objDel();
}
}
From the Window Application:
lib objLib = new lib();
objLib.objDel = new lib.myDel(sample);
objLib.Execute();
</code>
<pre>
<div class="ForumSig">Regards,
Arun Kumar.A</div>
|
|
|
|
|
That's me ..
public partial class Form1 : Form
{
RegistryKey key;
public Form1()
{
InitializeComponent();
key = Registry.CurrentUser.OpenSubKey(@"HKEY_CURRENT_USER\Software\NanoSoft\Preferences",true);
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
if (checkBox1.Checked)
{
key.SetValue("Assistant", "1", RegistryValueKind.String);
}
else
key.SetValue("Assistant", "0", RegistryValueKind.String);
Nothing happens
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Muammar© wrote: key = Registry.CurrentUser.OpenSubKey(@"HKEY_CURRENT_USER\Software\NanoSoft\Preferences",true);
Thats current_user twice.
|
|
|
|
|
As the subject says, I screwed up
Thanks Luc, I've been blind to see it for the previous half an hour
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Sorry, I wanted to vote 5 but accidentally I hit 4!
Thanks Luc!
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hi! Can anyone tell me how to set the Visual Studion 2005 to display all the windows auto-generated code like in Visual Studio 2003? In 2003 I can see all the codes of what has been created for me, and I can modify it to whatever I want. But in 2005 I can't see those codes. If anyone has done it before, please give me a hand. Thank you in advance for your time.
Best regard,
Jack
From Hell With Love
|
|
|
|
|
In VS2005, the auto generated code is in a seperate file, due to the existence of partial classes. It's called yourfile.designer.cs.
You can't change it back.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
That's very sad... After all I'll have to reinstall my VS 2003. Thanks for your help Mr. Graus.
Best regards,
Jack Toke
From Hell With Love
|
|
|
|
|
What on earth for ? Why is having the IDE hide it's autogenerated code in another file ( which you can open and read all you like ) a problem ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: Why is having the IDE hide it's autogenerated code in another file ( which you can open and read all you like ) a problem ?
And for that he wants to move back from .NET 2.0 to 1.1?
Cheers,
Vıkram.
Déjà moo - The feeling that you've seen this bull before.
Join the CP group at NationStates. Password: byalmightybob
|
|
|
|
|
hi,
in 2003, if you add a form to your project it will create two files: Form1.cs (in C#) and Form1.resx. and all you design time and other codes will be in the Form1.cs file.
but in 2005, it will create 3 files: Form1.cs, Form1.Designer.cs and Form1.resx. Form1.cs contains the code that you type such as event handlers and other functions, and Form1.Designer1.cs contains the auto generated design time code.
so, if you want to modify the design time code, open the Form1.Designer.cs file and make the changes.
hope this helps
ragards
|
|
|
|
|
Oh! You have been a great help. I never know this before. Thanks alot.
I begin to like this codeproject now. I can get help in a matter of minutes. Very cool.
All the best,
Jack Toke
From Hell With Love
|
|
|
|
|
OK - cool. I did tell you where the file was. Editing them by hand is generally a bad idea, but you can still do it.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
jackptoke wrote: I can get help in a matter of minutes. Very cool.
Don't count it every time. We all have lives too, you know.
|
|
|
|
|
Dear All,
I need to add some text on an image( may be in bmp or jpg format). I have to do it using C#.
Can anyone help me? Plz give me some hint.
Enamul Hoque
|
|
|
|