|
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
|
|
|
|
|
|
I read the article, but it seems to focus more on manipulating the property grid by modifying attributes on classes that are to be used in it.
Unforunately, this hasn't solved my problem, as I am exploring existing classes.
Although, i just had a thought, would it be possible to set NOT FlagsAttribute in a BrowsableAttributes class? I'll go exlore this.
Cata
|
|
|
|
|
Hai to all,
I want to create a simple TCP based network application, where client and server communicates with encryption. I tried to use streamwriter ans streamreader classes for non- encrypted application. I don't know how to use CryptoStream with the above streamwriter ans streamreader classes.
Early response is encouraged.
|
|
|
|
|
My article on YEnc encoding[^] has a sample of this. Just scroll down to the 2 highlighted pieces of code. You can substitute any encoder (implementation of ICryptoTransform), instead of my YEnc one.
my blog
|
|
|
|
|
Is there any way to make a property grid so that it is only GET, and does not give a SET option?
Cheers
Cata
|
|
|
|
|
Im trying to fill an array with the objects returned from the DTE method:
GetObject("winmgmts:{(Shutdown)}").ExecQuery("Select * from Win32_OperatingSystem")
I read through the documentation in VS.NET but am unsure how to properly reference the DTE class so that i can use the GetObject() method. I added a reference to envdte.dll and tried to create a new DTE object, but could not get it to work.
Any advice or code snippets on how to do this would be appriciated.
|
|
|
|
|
Uhhh...none of this is making any sense to me. What are your trying to accompish here? You posted code, VB code from the looks of it!, to get the Operating System parameters from WMI. What does this have to do with the Visual Studio IDE?
DTE.GetOject will return an object inside the IDE. As far as I know, it won't return an external object, like a WMI Provider.
If your trying to return the OS parameters from WMI, try using the System.Management namespace, specifically, the ObjectQuery[^] class.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
ObjectQuery did what I wanted, thanks for the response.
|
|
|
|
|
Good morning.
In case it matters, I am using Windows XP SP2 and Visual Studio .NET 2003 Enterprise (VS2003).
I am just starting a new project and decided to use the XML-based documentation comments. I am currently using VS2003's built-in option to create HTML files (Tools | Build Comment Web Pages). After noticing the files weren't working in IE (due to the restricted zone problem in SP2), I created a virtual directory under IIS and loaded the files from there. Now the pages work fine in IE.
However, the files won't work correctly in Mozilla 1.7.5 or Firefox 1.0.1. I assume that the problem is that the HTML files written using document.all as opposed to document.getElementById().
Does anybody have a work-around to make cross-browser friendly HTML pages?
Thanks,
Jim.
|
|
|
|
|
|
|
I wanna send ASCII data to a specific IP, is there anyone know about this?
thx all...
|
|
|
|
|
the easiest way to do this should be to use the TcpClient object. This object can connect to an IP and open up a stream. Then you can use a StreamWriter to write the chars into the stream.
|
|
|
|
|
thanks for your reply... it works,
And now , how can I get clients IP do you know that.
thx.
|
|
|
|
|
I've written a little program that creates a form using reflection, however, when I attempt to show this form, it throws an error:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ComponentModel.Win32Exception: Class already exists
at System.Windows.Forms.WindowClass.RegisterClass()
at System.Windows.Forms.WindowClass..ctor(String className, Int32 classStyle)
at System.Windows.Forms.WindowClass.Create(String className, Int32 classStyle)
at System.Windows.Forms.NativeWindow.CreateHandle(CreateParams cp)
at System.Windows.Forms.Control.CreateHandle()
at System.Windows.Forms.Form.CreateHandle()
at System.Windows.Forms.Control.get_Handle()
at System.Windows.Forms.Control.SetVisibleCore(Boolean value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at System.Windows.Forms.Control.Show()
the only other form that exists is my primary application form.
Does anyone know what causes this?
Cheers
Cata
|
|
|
|
|
|
It's just a blank form, default constructor variables. Nothing added.
|
|
|
|
|
|
Sorry, i think i made a slight mistake.
I was trying to construct a base form. Rather than an inherited one. It caused problems.
Will make sure i don't try that again
Cata
|
|
|
|
|
Try posting the code your using to do this. We can't tell what you did from the Exception, but the Exception message does help.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
It appears in this context the 'Class' means that the form attempted to register a new 'Class' (Description of a window) with the Win32 API RegisterClass. I do think posting the code might help.
-
Drew
|
|
|
|