|
hi to all,
i have a treeview with some nodes with checkboxes
when the user check or uncheck a parent node, i want to check or uncheck all the child nodes (child nodes are maybe checked or unchecked)
can someone post some code sample
best regards and thanks in advance
fady
|
|
|
|
|
Hi!
You can solve this task by using a simple recursive function:
void CheckChildNodes(TreeNode parent, bool checked)
{
parent.Checked = checked;
foreach (TreeNode nd in parent.Nodes)
CheckChildNodes(nd, checked);
} Regards,
mav
|
|
|
|
|
|
since my project is a forms app written in C# this seems like the spot for this.
i have installed the directx sdk 2005, i have the microsoft namespaces in my c:\\windows\assembly folder, but when i try to include one of these namespaces my compiler generates an error saying that namespace Microsoft.DirectX doesn't exist. The only microsoft namespaces are microsoft.win32 and 2 other which i can't remember right now.
so i've installed the sdk, allowe it to add references to the .net framework but i ca't use the namespaces
i would like to add these namespaces to my project but don't know what to do any help guy's?
m$: It is normal for your screen to go blank and for your computer to restart itself several times
|
|
|
|
|
In your project, did you add references to the Managed DirectX .DLL's?
I think th filenames all start with Microsoft.DirectX.xxxx.dll?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-- modified at 9:12 Friday 6th January, 2006
|
|
|
|
|
i would like to romove or hide title bar from the window form. how can i acheive this functionality.
Amit Grover
CDAC R&D
|
|
|
|
|
Hi Amit,
just clear the text property of the form and change the FormBorderStyle to Single/Resizable..
Regards,
Pramod
|
|
|
|
|
Hi everybody,
I am developing a library for my company and encounter a problem. In my code, I need to know and enumerate through all the derived classes of a base class. Are there any way to get the derived classes of a base class by using reflection in C#?
Hope your replies, thanks.
Lan hue sau ai lan hue heo
Lan hue sau doi trong heo ngoai tuoi
|
|
|
|
|
You can iterate over every type in an assembly and check IsAssignableFrom(yourBaseType)
|
|
|
|
|
I got it! Thank you for you helping!
Lan hue sau ai lan hue heo
Lan hue sau doi trong heo ngoai tuoi
|
|
|
|
|
Can we know why you do this? It's usually a bad idea for code to know derived classes from base classes.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi,
Here is the context that I use reflection:
- The library has a base class, e.g AbstractAlgorithm, and some derived classes, e.g ConcreteAlgorithm1, ConcreteAlgorithm2, ... We can get an algorithm instance like this: AbstractAlgorithm algo = new ConcreateAlgorithm1();
- I want to provide another way for client to get an algorithm instance by its name like this: AbstractAlgorithm algo = AlgorithmFactory.createInstance("XYZ algorithm");
So I add an abstract method "getName()" to AbstractAlgorithm base class and each concreate algorithm class implements this method to return its name. The "createInstance(string)" method of AlgorithmFactory will use reflection to enumerate through the derived classes of AbstractAlgorithm, call their "getName()" methods to select the right algorithm class. After that, I use .NET class Activator to create an algorithm instance of the selected class. By doing this (instead of using "switch case" statement), the "createInstance(string)" method is unchanged when new concrete algorithm classes are added to the library.
Is it a right design?
Hope to see your opinion.
Lan hue sau ai lan hue heo
Lan hue sau doi trong heo ngoai tuoi
|
|
|
|
|
How about simply passing the type of the derived class, instead of a string representing the type? Something like
AlgorithmFactory.CreateInstance(typeof(ConcreteAlgorithm1));
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I think client will prefer short and friendly name to long and hard to remember class name. I just study it from the Java Cryptography Framework. We can get an MD5 hash algorithm like this: MessageDigest md = MessageDigest.getInstance("MD5"); We do not need to know the name of the class that implements the MD5 hash algorithm.
Hope to see your opinion.
Lan hue sau ai lan hue heo
Lan hue sau doi trong heo ngoai tuoi
|
|
|
|
|
Yeah, it's a tradeoff :- with type names, you get compile time errors if the user passes an invalid type, with strings, you don't. OTOH, like you said, it's more convenient for the users..
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Yes, it's a trade-off.
Thanks for sharing your opinion.
Lan hue sau ai lan hue heo
Lan hue sau doi trong heo ngoai tuoi
|
|
|
|
|
hi guys.... juz wanna ask a favor. can you give me some sample codes of C#. i rili think that inventory sample codes will help me... thanks again....
|
|
|
|
|
Have you searched MSDN? There is lots of sample code that is well expained with good annotation. Have you searched other resources? If you have written some code that isn't working and you don't understand why then we can help. If you need a pointer to a particular coding technique we can point you in the right direction. Your request is too vague. If you are desperate for a whole inventory system in C# why not search through some open source repositories.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|
|
knight_sky wrote: can you give me some sample codes of C#.
What color? Size? Flavor? Please be specific. There's a lot of C# code to choose from.
/ravi
My new year's resolution: 2048 x 1536
Home | Music | Articles | Freeware | Trips
ravib(at)ravib(dot)com
|
|
|
|
|
go CHEAT somewhere else...
get some books
do a google search
|
|
|
|
|
You're comment of cheating makes no sense what so ever.
I agree with the google search and books are but that is not really a good idea unless you know what you are looking for.
not all books related to programming are idea. Most Theory are questionable.
|
|
|
|
|
aerosmith2k1 wrote: cheating makes no sense what so ever
he's asking for complete source to an inventory control program. if not in this post, in another post he made. yeah i call that cheating.
|
|
|
|
|
hi guys! i'm an information technology student. i just want to seek help regarding my thesis. its about sales inventory system and book directory system of a bookstore. our prof want us to use C#. well it is very new to all of us, so i rili nid ur help. thanks... i'll wait for u'r reply. i'm rili desperate.
pls and thank you!
|
|
|
|
|
|
Be specific - what exactly do you need help with. You just made a series of vague comments that no one can really use to help you.
ColinMackay.net
"Man who stand on hill with mouth open will wait long time for roast duck to drop in." -- Confucius
"If a man empties his purse into his head, no man can take it away from him, for an investment in knowledge pays the best interest." -- Joseph E. O'Donnell
|
|
|
|