How I can hide a public property in Visual ?

  • Thread starter Thread starter Boniek
  • Start date Start date
B

Boniek

Hi

I define a public property in a new form and I can see this property in
table of Properties in Visual. How I can hide this property to see only in
code ?

Thank's Boniek
 
Hi Boniek,
Hi

I define a public property in a new form and I can see this property in
table of Properties in Visual. How I can hide this property to see only in
code ?

Thank's Boniek

Add BrowsableAttribute, and set its value to false.

e.g.:

[Browsable(false)]
public bool MyBoolProperty {
get {
//
}
}

Cheers!

Marcin
 
Hi
I define a public property in a new form and I can see this property in
table of Properties in Visual. How I can hide this property to see only in
code ?

Thank's Boniek

Add BrowsableAttribute, and set its value to false.

e.g.:

[Browsable(false)]
public bool MyBoolProperty {
get {
//
}
}

Cheers!

Marcin

Thank's Marcin
 
Boniek.

alternate way to hide a property displaying is changing access mode from
"public" to "internal". However, read the documentation of internal before
implementing it becoz it has its own limitations.

Shak.
 
Here's the code fragment of the function. :

private void BlastOff(Mass mass, float dt)
{
Unit unit = mass.Unit;

if (null == unit || ! unit.Enabled)
return;

The stack trace (which I can't seem to find right now) definitely
nails the 'if' statement as the culprit.
Well, what is "unit" in this case? If it overloads the == operator,
that could be the problem. Are you *absolutely* sure it's actually
occurring on this line, rather than near it? Could you post some more
code?

Unit does override the CompareTo() function. By the variable naming
convention of the function, I most likely stole this right out of the
C# docs:
public enum UnitType
{
Apple,
Orange,
Elephant,
}

[XmlAttribute("type")]
public UnitType Type
{
get{return unitType;}
set{unitType=value;}
}


public int CompareTo(object obj)
{
Unit u = (Unit)obj;
if(this.Type == u.Type)
return 0;
else if (this.Type > u.Type)
return 1;
else
return -1;
}

I could see how this may generate a null reference exception, but like
I said, I get the null reference exception randomly. And the unit
object is null pretty much most of the time.

I will note that I'm using the DirectX API. It is using native
interop calls, possibly backing up my memory corruption claim.

While we're at it, I have another null reference exception that makes
no sense. Granted, the DX API may be having some issues of its own.
The setup for this is that I'm accessing an object out of an array
several times. (I own none of the implemenation behind this code, it's
all DirectX calls). 99.99% of the time, no problems. Once, I got this
null reference exception:

Code Frag:
device.TextureState[0].AlphaOperation = TextureOperation.Modulate;
device.TextureState[0].AlphaArgument0 = TextureArgument.Current;
device.TextureState[0].AlphaArgument1 =
TextureArgument.TextureColor;
device.TextureState[0].AlphaArgument2 = TextureArgument.Diffuse;

device.TextureState[0].ColorArgument0 = TextureArgument.Current; //
null reference happens here
device.TextureState[0].ColorArgument1
= TextureArgument.TextureColor;
device.TextureState[0].ColorArgument2 = TextureArgument.Diffuse;
device.TextureState[0].ColorOperation = TextureOperation.Modulate;

Here's the stack trace.

System.NullReferenceException: Object reference not set to an instance
of an object.
at Microsoft.DirectX.Direct3D.TextureStates.get_TextureState(Int32
index)
at Lib.Rasterizer.MonkeyBusiness.SpriteBegin() in C:\Documents and
Settings\bladieblabla\My
Documents\Project\Rasterizer\MonkeyBusiness.cs:line 368
at Lib.Rasterizer.MonkeyBusiness.Draw(Vector2 destination, Int32
frameNumber, Int32 alpha) in C:\Documents and Settings\bladieblabla\My
Documents\Project\Rasterizer\MonkeyBusiness.cs:line 394


One thing I notice is that I get these in clusters. When I reboot,
they seem to go away for ahile.

My major problem is that I get these, and I can't find the root cause.
In C++, I would be looking for that stray pointer. C#, what could
have a stray pointer?
 
Marshall Belew said:
Here's the code fragment of the function. :

private void BlastOff(Mass mass, float dt)
{
Unit unit = mass.Unit;

if (null == unit || ! unit.Enabled)
return;

The stack trace (which I can't seem to find right now) definitely
nails the 'if' statement as the culprit.

Hmm... I've seen a few dodgy stack traces before now. I have to
wonder...
Unit does override the CompareTo() function.

That's not relevant. It's only if it overloads the == operator that
it's relevant.
I will note that I'm using the DirectX API. It is using native
interop calls, possibly backing up my memory corruption claim.

Mmm... possibly.
While we're at it, I have another null reference exception that makes
no sense. Granted, the DX API may be having some issues of its own.
The setup for this is that I'm accessing an object out of an array
several times. (I own none of the implemenation behind this code, it's
all DirectX calls). 99.99% of the time, no problems. Once, I got this
null reference exception:

Code Frag:
device.TextureState[0].AlphaOperation = TextureOperation.Modulate;

<snip>

I'm not familiar enough the DirectX to know - are the TextureStates
meant to be set up for you, or do you have to set them up yourself?
One thing I notice is that I get these in clusters. When I reboot,
they seem to go away for ahile.

My major problem is that I get these, and I can't find the root cause.
In C++, I would be looking for that stray pointer. C#, what could
have a stray pointer?

Well, that depends on exactly what you mean by "stray pointer" - but if
you're doing interop, it could be that you're not pinning something you
should be, perhaps. (If you're using the DirectX SDK, it should be
taking care of that for you though.)
 
Back
Top