|
Is there a colour picker in C# to choose from the Color enumeration by color or name ? If not, I thought I might write one, but I'd hate to do it and find out there's one as standard....
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
|
|
|
|
|
Just the good old Color Dialog is truly documented.
I did notice a number of color pickers in the C#/Controls section here on Code Project.
Regards
|
|
|
|
|
Hi everyone,
i have an ArrayList where I have some object from my class Cxxxx. each object has one ArrayList where i would have object of my class Cxx2, but i need that this second ArrayList must be create later, only when i need, so i need to know if exist any way to access some object of Array List and modify it content.
Thanks in advance.
Salamanca 2002 Capital Cultural Europea, Visitala
|
|
|
|
|
What?
Did you try the indexer?
i.e.
MyObject o = (MyObject) myArray[i];
.
.
.
Regards
|
|
|
|
|
In C++, I would declare my data values as private members with public get/set methods. I can do the same thing in C#, but I can also use properties. Any guideance on when to use one vs the other? Is there any performance/size difference? Thanks
Chris Hafey
|
|
|
|
|
Properties basically accomplish the same thing. Each propert should have an accompanying private field for the actual value. The only advantage is that you can do this :-
abc.val = whatever;
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
You should use properties when you are dealing with storing the data in a private variable.
You should use Get/Set methods when that data is NOT being stored cannot be accessed as quickly as a "return myPrivateData;". Some applications of this type would be retreive the customer name from the database; return all the prcoesses running on the system, etc...
The line is a fine one and its quite elastic so just go with what feels right
James
Simplicity Rules!
|
|
|
|
|
Stick with Properties when appropriate.
The Property Grid likes them, the debugger likes them, and Serialization likes them.
Go with the flow, it will make your life easier...
Regards
|
|
|
|
|
Hi All,
Quick question here, I need to check to see if a cookie exists when someone enters 1 of my pages.
This is an intranet so I know that everyone accepts cookies but is there way to see if a certain cookie exists?
Thanks,
Gavin
|
|
|
|
|
Check the cookie for null
James
Simplicity Rules!
|
|
|
|
|
Tried that,
for some reason the page falls over if I try the following
if (HttpContext.Current.Request.Cookies["NewOutbreak"]["Test"] == "")
{
//Do Something amazing
}
else
{
Go home
}
I get an error saying something like cannot check for null as it doesn't exist.??
|
|
|
|
|
I wonder if you are getting the error from the "NewOutbreak" cookie not existing and then trying to access it.
Give this a shot...
<br />
Request r = HttpContext.Current.Request;<br />
if(r.Cookies["NewOutbreak"] == null)<br />
{<br />
}<br />
else if( r.Cookies["NewOutbreak"]["Test"] == null)<br />
{<br />
}<br />
else<br />
{<br />
}
I'm still working out your issue at the top
James
Simplicity Rules!
|
|
|
|
|
werkin
I see the logic, you have to check to see if the Cookie exists before checking to see if the cookies key exists or has any data...
Seems to be 100% Thanks
|
|
|
|
|
Hi,
How do you make a text box on a windows form accept numbers only?
These is really easy in VC++ 6.0, can't be hard in C#
Cheers
Ollie Riches
|
|
|
|
|
there's already a thread about that problem in this forum (currently on the next page)
:wq
|
|
|
|
|
I know two way for it.
One:
http://www.codeproject.com/cs/miscctrl/maskedcsedit.asp
Two:
Handle KeyPress event of text box yourself:
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar < 48 || e.KeyChar > 57 )
e.Handled = true;
}
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
The Answer is...
http://www.codeproject.com/script/comments/forums.asp?forumid=1649&select=160478&fr=51#xx159561xx
|
|
|
|
|
Magic is a fee source code user interface library for .NET
Now includes completely rewritten docking code that allows...
multiple docking windows in same column/row
multiple docking windows in same floating form
multiple content in same docking window
save/load docking configuration
MDI support in the MenuControl via a pendant
Numerous bug fixes
http://www.dotnetmagic.com
PS. I could not find an annoucement board as the proper place to put this. Is there one I have missed?
Phil Wright
phil.wright@dotnetmagic.com
|
|
|
|
|
Phil Wright wrote:
PS. I could not find an annoucement board as the proper place to put this. Is there one I have missed?
Good attempt at naivety
But it didn't work pal, not even a little
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
Good works realy.
aspecially for docking one of the best solution i've seen.
Continue.
Continue to let it free.
Phil Wright wrote:
PS. I could not find an annoucement board as the proper place to put this. Is there one I have missed?
You must write an article and quote your site.
i thinks programers believe it's commercial if u didn't (boring after all you efforts)
thanxs
|
|
|
|
|
I created a custom control derived from a panel in which I added flat buttons but how can I add action on the buttons dynamicly ???
I can't because the class is derived from a panel.
Anybody can help me ?
|
|
|
|
|
You could expose your buttons via a property as a collection (of buttons). But then you are exposing everything about the buttons.
|
|
|
|
|
Doh! Then again, there is nothing stopping you from accessing the built-in Controls collection of the Panel and attaching an event handler dynamically.
|
|
|
|
|
You can expose event properties on your control; like so...
public EventHandler ButtonA_Click
{
add
{
buttona.Click += new EventHandler(value);
}
remove
{
buttona.Click -= new EventHandler(value);
}
} You wind up with having to name the events something different, but you can control what events are available.
HTH,
James
Simplicity Rules!
|
|
|
|
|
The problem is that I create only one instance of a button and Each I wrote tb.AddItem("Test",Color.Black,Color.White,0); (that's an example)
the control add a button itself to the parent control which is a panel.
so how can I handle all the buttons actions when I have only one Button Instance ??
can I make a function like ItemClick(int index,EventHandler action) ??
if yes can u plz give me some code because I try to use this with a switch statement and I got an error :
"a value constant is expected"
Thanks
|
|
|
|