|
Hello,
Glad I could help!
To make your code a little more OOP, you could use a special EventArgs class defined in the UserControl.
This would pass the Checked property of the checkbox over the event.
So there would be no more need for the property in the UserControl. (Saves a little bit of memory, specially if you have that much controls).
The other advantage is that you than only have to cast to Control and not UserControl, which takes a little more time I think.
Add a class:
public class EventArgsUserControl : System.EventArgs
{
public bool RemoveMe = false;
public EventArgsUserControl(bool removeme)
{
RemoveMe = removeme;
}
}
Changes in UserControl:
Remove:
public bool RemoveMe
{
get
{
return checkBox1.Checked;
}
}
Add new delegate:
public event UserControlEventHandler CheckedChanged;
public delegate void UserControlEventHandler(object sender, EventArgsUserControl eauc);
Change To:
private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{
if (CheckedChanged != null)
{
CheckedChanged(this, new EventArgsUserControl(checkBox1.Checked));
}
}
Changes in Form:
link to your new delegate
private void Form1_ControlAdded(object sender, ControlEventArgs e)
{
UserControl1 uc = e.Control as UserControl1;
if(uc!=null)
{
uc.CheckedChanged+=new UserControlEventHandler(uc_CheckedChanged);
}
}
disconnect it like this
uc.CheckedChanged-=new UserControlEventHandler(uc_CheckedChanged);
New checkedchanged code, without casting to UserControl
private void uc_CheckedChanged(object sender, EventArgsUserControl e)
{
Control c = sender as Control;
if(c!=null)
{
if(e.RemoveMe)
{
removableUC.Add(c);
}
else
{
if(removableUC.Contains(c))
{
removableUC.Remove(c);
}
}
}
}
It might sound not neccessary in this special case, but you should consider it as good programming practice.
Hope it helps!
All the best,
Martin
|
|
|
|
|
I have image... How can i read character from image.........
Please any body tell me..
Thanks & Regards,
S.Sajan
S.Sajan
|
|
|
|
|
Wow...it is not so easy
I found some interesting PDFs on google using the keywords "OCR algorithm".
Russell
|
|
|
|
|
hi all
apologies first if I'm being dim here but....
i'm using XML-RPC to do send a request which is fine but the response I get back is basically a string in the format of a querystring eg ?foo=1&bar=2 is there a way I can *magically* turn this into a querystring to access the values returned to me ?
Normally it would be foo = Request.QueryString["foo"]. Can I access the string as a series of name/value pairs or do I have to make the array myself from the string to access them ?
TIA
t
|
|
|
|
|
Hi!
I want to include a created icon to my setup, so that when somebody installs my application this application has my created icon as Icon.
Does anybody know what properties I have to select
Thanks a lot
Johannes
|
|
|
|
|
Click on the setup project. Press F4. On of those properties will allow you to select an icon.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
Thanks for fast answer!
Actual, the problem still exists. I know how to select an Icon for desktop and also for the created exe-file. But in the start-menu of windows the icon still does not exist and I don't know why!
Johannes
|
|
|
|
|
In the file system, in the "User's Programs Menu" or "User's Desktop" you create a new shortcut. The properties for the short cut include "Icon"
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
* Reading: Developer Day 5
Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton
My website
|
|
|
|
|
Okay, got the solution!
My icon was to big for being displayed in the start menu
Thanx
|
|
|
|
|
go to project details and there you can find the option to browse an icon!
|
|
|
|
|
Hello everyone
Working at a Intranet solution where we are gonna pull Active Directory(AD) data on the user and ofcause authenticate the user.
I have been experimenting with different approches like
* manually logging in a user(admin loging, as the ordinary user isnt allowed to search the AD). And for that matter the user him/her self for testing.
* WindowsIndenity(btw. does this work on mac, linux etc) which works just fine for the Authentication part - but not the "data part"
Now the problem accours when we dont want the User to manually login(Enter username/password) but prefer to have it done automaticly in the background - kinda like WindowsIndentity.
One solution would be to obtain the users login/initials so we can search for the user in AD after (through a admin login)
So my question: is this even possible ? and if so how? aint asking for a full written code, just a few pointers and so
My worry is ofcause that it aint possible due to Security reasons.
Best Regards
-Klaus M. Jensen
|
|
|
|
|
Hello,
I've creating some classes and collections which use generic like :
class SomeCollection<T> : ACollection where T : class
But I also have nested collections so sometimes the type of an object is like :
SomeCollection<MyCollection<MyObject>> someColl;
Does a "typedef" or alias exists in C# ?
I know aliases are used with namespaces, but I didn't find anything for types.
I'd like to have :
"typedef" SomeCollection<MyCollection<MyObject>> TheCollection;<br />
TheCollection coll = new TheCollection();
Thanks.
-- modified at 4:48 Thursday 14th June, 2007
|
|
|
|
|
Hi, how about:
using System.Collections.Generic;
using ListListInt=System.Collections.Generic.List<System.Collections.Generic.List<int>>;
class myClass {
ListListInt myListOfListsOfInts=new ListListInt();
}
-- modified at 7:18 Thursday 14th June, 2007
Luc Pattyn
[My Articles] [Forum Guidelines]
|
|
|
|
|
Thanks for the reply, but the alias ListListInt is available only in the scope of the file, not through the whole project. And I don't want to define it everywhere I use it.
I searched answers to that problem, and the only way to do it is to create a new class :
public class ListlistInt : System.Collections.Generic.List<System.Collections.Generic.List<int>>
{
}
Maybe I'll do it that way, and create a "header"-like file where I store all those kind of "alias" classes...
|
|
|
|
|
Gatchan wrote: the alias ListListInt is available only in the scope of the file
same is true if you insert a typedef in a C or C++ source file...
Gatchan wrote: create a new class
OK
Gatchan wrote: a "header"-like file
I suggest you either put such classes in the same namespace as your current project;
or make them part of a new namespace that lives in a separate reusable class library
project (and DLL file).
|
|
|
|
|
I am trying to access (read) registry of a remote system. I am using RemoteRegistry but is giving Exception : Attempted to perform an unauthorized operation.
So i want change the permission to read registry programmatically.
Plz... reply soon...
Regards.
Devesh Mishra
|
|
|
|
|
Hi all,
I'm Newbie. How to passing parameter's values from Form to crystal report?
Just say I have some textBoxs. I want TextBox's value pass to crystal report so that i can print them to printer in the right margins.
Please Help.
Thx
|
|
|
|
|
Search CrystalReport push method Click Go button on the top panel of CP
You will get the answer
ALL THE BEST
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
I like it!
|
|
|
|
|
|
Sylvester George wrote: Trying to turn your eyes on me
I guess my wife would have some problems with that!
|
|
|
|
|
|
Hi all,
Sub TestAdd()<br />
<br />
Dim miDocSrc As MODI.Document<br />
Dim miDocDest As MODI.Document<br />
<br />
Set miDocSrc = New MODI.Document<br />
Set miDocDest = New MODI.Document<br />
miDocSrc.Create "C:\document1.tif"<br />
miDocDest.Create<br />
<br />
With miDocDest.Images<br />
.Add miDocSrc.Images(0), Nothing<br />
.Add miDocSrc.Images(2), Nothing<br />
.Add miDocSrc.Images(1), miDocDest.Images(1)<br />
End With<br />
<br />
miDocDest.SaveAs "C:\document2.mdi", miFILE_FORMAT_MDI<br />
<br />
Set miDocDest = Nothing<br />
Set miDocSrc = Nothing<br />
<br />
End Sub<br />
<br />
How could i convert above the only Bolded code into c# .NET
thanks in advance
|
|
|
|
|
hi surezu
try this:
miDocDest.Images.Add(miDocSrc.Images(0), null);
miDocDest.Images.Add(miDocSrc.Images(2), null);
miDocDest.Images.Add(miDocSrc.Images(1), miDocDest.Images(1));
regards
|
|
|
|
|
hi
i need to attach a audio file in my application .plz help me how can i do this
|
|
|
|