|
Just select the root node of the treeview and call its Expand or ExpandAll method.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
For a particular TreeNode :
TreeView.Nodes[...].Expand()
(of course you can expand particular nodes a a paricular node as well)
For all nodes in a TreeView :
TreeView.ExpandAll()
//Kordzik
|
|
|
|
|
Oooops someone already posted that. Didn't refresh & didn't know
|
|
|
|
|
Hi.
I hava a little problem, in my code I have a System.Type object, I know that the class this system type object points to contains a static function called "string InputAPI()", but I don't know how to access it through the system type.
So how can I call a static function through a System.Type object?
All I know about the class that the System.Type points to is that it inherits from an abstract class called IMouse, which contains the "string InputAPI()" function.
|
|
|
|
|
You can use reflection to call a static member of a type.
For instance:
<code>
using System;
using System.Reflection;
public class ClassWithStaticMember
{
public static string GetMessage()
{
return "Here is a message from a static member.";
}
}
public class Client
{
public string CallStaticMemberByType(Type t)
{
// Make sure the type is valid
if (t == typeof(ClassWithStaticMember))
{
return (string)t.InvokeMember("GetMessage", BindingFlags.Public | BindingFlags.Static | BindingFlags.InvokeMethod, null, t, null);
}
else
{
return "The type was incompatible with the member required.";
}
}
}
</code>
Hope this helps.
<div style="COLOR: black; FONT-STYLE: italic; FONT-FAMILY: Arial; BACKGROUND-COLOR: lightsteelblue">The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’</div>
|
|
|
|
|
Thanks, it works.
I had tried that function, but I didn't know what to pass in the second last parameter, when passing null it didn't work .
|
|
|
|
|
Hello Gurus,
I would like to know if there is a .NET way (no Win32 API) to open special file names that are starting with the sequence "\\.\"? When I try to open the file with the System.IO.File.Open method, I get an exception:
<br />
An unhandled exception of type 'System.ArgumentException' occurred in mscorlib.dll<br />
<br />
Additional information: FileStream will not open Win32 devices such as disk partitions and tape drives. Don't use "\\.\" in your path.<br />
so, how can I access to such a path without using the Win32 API?
Best regards.
There is no spoon.
|
|
|
|
|
You can't. What do you think the FileStream classes wrap?
If you want to use these kind of paths, you MUST use the Win32 API to do it.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hey,
im trying to extract a jpg files width and height using C#.
up untill now i didnt find any thing usefull.
can someone help me out.
thanx...
|
|
|
|
|
Do you have the jpg loaded into an System.Drawing.Image object? If so, you should be able to use the Width and Height properties.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
I'm trying to connect a usb camera up, and take a picture and save it using C#. I can't find any example code. Can anyone point me in the right direction.
|
|
|
|
|
give up, not worth it
IM PROUD TO BE A GMAIL;
|
|
|
|
|
You can't find any example code because this kind of thing is usually done with the Software Development Kit (SDK) that you MIGHT be able to get from the manufacturer of the camera.
There are generic ways to get at the camera, but in way is it garanteed to work and your functionality is pretty limited. Check into Windows Image Acquisition, or WIA.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
That will be hard unless you have some generic camera with a published SDK. Pretty much every camera out there is proprietary.
/\ |_ E X E GG
|
|
|
|
|
hi everyone..
does anyone know how to use ADOBC?? I just need a sample code of few lines if possible.. It does not seem to be working like OleDB
THanks
E.T.
|
|
|
|
|
Do you mean ODBC?
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
No - this is a special version of ADO developed for users in British Columbia (or was it the Stone Age ??).
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Hey
I have connected a event to a serialport this way
serialPort.ReceivedEvent += new SerialReceivedEventHandler(serialPort_ReceivedEvent);
This event is sopose to be fired when data is written to the com port from a cellphone(or what ever).
this works fine on 3 of my computers, but not on my main computer?
All the computers is running Windows XP and Framework 2.0
How is this posible? and what may be the problem?
BestRegards
SnowJim
|
|
|
|
|
I have two classes, ClassA and ClassB:
public class ClassA<br />
{<br />
private int intProperty;<br />
<br />
public int Property<br />
{ <br />
get<br />
{<br />
return intProperty;<br />
} <br />
set<br />
{ <br />
intProperty = value; <br />
} <br />
}<br />
<br />
public ClassA()<br />
{<br />
ClassBTest = new ClassB();<br />
}<br />
}
My question is, how do I access and modify ClassA.Property from ClassB?
For example (understanding that this doesn't actually work):
<br />
public class ClassB()<br />
{<br />
private int Function()<br />
{<br />
int Temp = ClassA.Property;<br />
Temp++<br />
ClassA.Property = Temp;<br />
}<br />
}
There's got to be a fundamental way to do this, I'm just missing that piece of information.
Thanks for your help.
|
|
|
|
|
what use wrote in your code was the use of a static property.
if you use ClassA.Property
the property definition must be:
public static int Proprty {...}
But you can also use is this way you code it. But then you must create an instance of the class to use the property:
ClassA c = new ClassA();
int Temp = c.Property;
|
|
|
|
|
That's my dilemma: I need a solution more advanced than that. I cannot create the new class; that defeats the entire purpose of my program. I have to interact with the existing class.
I'm playing with static members; that may give me what I need. Thanks.
|
|
|
|
|
then you must use it as static like this:
class ClassA
{
private static int i;
public static int Property
{
get
{
return i;
}
set
{
i = value;
}
}
}
then you can use it via
int i = ClassA.Property;
|
|
|
|
|
Works great, thanks.
Isn't it amazing how it's always the simple stuff you end up researching for eight hours?
I appreciate your help.
|
|
|
|
|
Just as an aside - doing what the first reply suggested would not lead to creating a new class. It would lead to creating a new instance of an existing class. Either way (static or instance), you're taking up space on the heap. The difference is that with a static member, all clients in the AppDomain shares a single instance of the static member, and with non-static (instantiation), each call gets a new copy of the object.
The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’
|
|
|
|
|
Is there any way to make a property grid so that it is only GET, and does not give a SET option?
I've had some problems with enum's not being happy with a default 0 value. And although I know enums are supposed to work with this, here is the error message:
[quote]
An unhandled exception of type 'System.ArgumentException' occurred in system.dll
Additional information: The value '0' is not a valid value for the enum 'DepthFormat'.
[/quote]
As a note, some of these enums are Flags and some are used by unmanaged code. If possible i'd like to find a workaround.
Cheers
Cata
|
|
|
|