|
hey I found it, just use {{ and }}
Console.Write("{0}-{{0}}",2);
(a.k.a. Wal2k) www.wal2k.com
|
|
|
|
|
Hi:
I'm working on a custom control that inherits System.Windows.Forms.Control. What I need the PropertyGrid control do is to hide most of the inherited properties of my custom control. There is a property BrowsableAttributes that is probably meant to do the job but I don't have the slightest idea how this is done! Is it possible for the PropertyGrid to show only the properties I specify?
10x,
Kaloyan
|
|
|
|
|
Using the attribute "[Browsable(false)]" should do the trick.
As an example ...
[Browsable(false)]
public string MyStringProp
{
get {....}
set {....}
}
would prevent the property grid from displaying the properity. Setting it to true then would allow the grid to display the properity.
Hey don't worry, I can handle it. I took something. I can see things no one else can see. Why are you dressed like that?
- Jack Burton
|
|
|
|
|
This, however, does not solve my situation... My control inherits around 30 properties from Control which I do not need. So the problem is that I want the PropertyGrid to display only those few that are specific to my control but not inherited from Control. If I use the approach you propose I'll have to add the Browsable(false) attribute to all inherited properties. And this takes a lot of time. The PropertyGrid, however, has that property: PropertyGrid.BrowsableAttributes (the last letter is the difference), which is meant to enable the grid to display only those prperties you want to display. That is what I'm asking and trying to solve in the same time.
Thanks for the response anyway...
Kaloyan
p.s. I fixed this one It turned out that PropertyGrid.BrowsableAttributes must be set to the attributes the properties I want to display have.(confusing, isn't it? )
|
|
|
|
|
I'd like to access the members of an event, such as the KeyDown event of a TextBox. Here's an example:
int handlerCount = textBox.KeyDown.GetInvocationList().Length;
This would tell me how many handlers are attached to this event. But the compiler doesn't like it, and gives me this error:
CS0079: The event 'System.Windows.Forms.Control.KeyDown' can only appear on the left hand side of += or -=
What's going on? How can I accomplish what I need?
Thanks,
Alvaro
When birds fly in the right formation, they need only exert half the effort. Even in nature, teamwork results in collective laziness. -- despair.com
|
|
|
|
|
Alvaro Mendez wrote:
What's going on? How can I accomplish what I need?
I had the same need and just couldnt get a solution...
I rated this article 2 by mistake. It deserves more. I wanted to get to the second page... - vjedlicka 3:33 25 Nov '02
|
|
|
|
|
check Control's event property
for example
this.Events
and it has a AddHandler and getting active handlers ..
Paresh
|
|
|
|
|
I am getting the following exception:
"System.ExecutionEngineException In System.Windows.Forms.Dll"
... and it is occuring when the code is just about to exit the Static void Main block:
[STAThread]<br />
static void Main() <br />
{<br />
Application.Run(new Form1());<br />
}
Has anyone any idea of what could be causing this?
Cheers
|
|
|
|
|
I would check the destructor of Form1 or one of its object's dtors. A stack trace would be of great help.
|
|
|
|
|
do you have some kind of Active X or image you are using ?
try to trace the constructor
put a break point in Form1's ctor and try debuging from there
u will be doing F11 not the F10 which skips method debuging.
and step by step you will know exact where it fails.
Paresh;)
|
|
|
|
|
I don't have any controls on the form at all.
What I do have in the form object is 4 objects instantiated from very similar classes in which I read data from btrieve table files destroy the data read and then it appears that when the 4th object has finished the form object has been GC'ed. I haven't put any destructors in for these objects and beleive this is the problem, as if I only instantiate one or two of these classes I don't lose the form object!
|
|
|
|
|
ExecutionEngineException is a kinda equivalent to the old Dr. Watson for Windows. If something that mscorlib or mscoree.dll (the .NET CLR) could not handle, it would throw this exception.
Any misconfigured or mailfunctioning COM components that you are using, might cause your RunTime to fail with this exception.
Deepak Kumar Vasudevan
http://deepak.portland.co.uk/
|
|
|
|
|
I want to draw a rectangle, circle ... or any shape on the document. How to move it and resize it on anywhere in document. Document can be drag on scrollbar.
|
|
|
|
|
can't you use it's
Location
Size
Property ?
|
|
|
|
|
I draw a shape (g.drawRectangle ... ) at point P. I want to move it to another point. When i move mouse to head of shape , mouse must be move-icon. Where else is mouse default ...Thanks
|
|
|
|
|
I am looking for some sample code to produce a "knight rider" style progress bar, does anybody have an sample code that produces this effect??
I had a look around on CP, but couldnt find anything. With the exception of :
http://www.codeproject.com/cs/miscctrl/progressbar.asp[^]
But unfortunatly the code is massive and my C# skills arent good enough to break it down to find what I need
|
|
|
|
|
I did one! I did one!.. Although its not entirely the same as the knight rider bar. Crap, it's part of my main lib, maybe I can rip it out for you. Although this particular one was done in VB, so maybe you would want to convert it...
Anyway, here it is have fun!
Busy Bar Test - Binary in there too.
Oh one more thing,... dont forget to turn the thing off (Disable it) when cleaning up the form it is on, because that damn Timer will keep the form alive indefinitely if you don't.
|
|
|
|
|
Absolutly brilliant
but (there is always a but)
Unfortunaltly its to fancy for the spec I am working too?!?! Boss man just wants a simple progress bar style that goes backwards and forwards.
I have been playing around and I get seem to find an option to set a minvalue for the bar - does this even exist?
|
|
|
|
|
MinValue? You can adjust the number of trails (.Trails) that are drawn (number of rectangles that make up the moving bar).. You can also adjust how often it gets updated. I guess if you up the time it is updated, adjust .speed a bit, and drop the trails to say, 20-30, it would be pretty fast on low end machines.
|
|
|
|
|
you will need to develop of your own/
you can develop the control where blocks are rectangle and colored with some black color (define a property) and when increased increases the counts of the rectangle with refresh.
Paresh
|
|
|
|
|
I want to setup a remote singleton that keeps a sequence (and increments it). I get the last sequence number from a database and before the object is garbage collected i want to save the value back to the database.
Should/Can i implement this in the singleton's finalize method or is there someway to use ILease and when Sponsorship times out, then save to the database?
|
|
|
|
|
|
MarshalByRefObject doesnt derive from Componnet so doesnt have Dispose, and you need to derive a remoted object from MarshalByRefObject.
|
|
|
|
|
check out this site itself there is a singleton sample !!!
|
|
|
|
|
I know that. I am using it as a base for some work that i am doing. But i dont know when the remoted object is destroyed, so i wanted to know about Finalize, since MarshalByRefObject doesnt derive from Componnet so doesnt have Dispose.
|
|
|
|