Click here to Skip to main content
15,923,168 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to add a Slider in System.Windows.Forms.Cntrols. But when I use this.Controls.Add(slider), it gives error: System.Windows.Controls.Control can not be typecast in System.Windows.Forms.Controls

Please give me solution.
Constraint: I cannot use WPF
Posted
Updated 15-Feb-11 20:09pm
v2

You can use System.Windows.Forms.TrackBar instead.

Also, controls like that are too easy to implement; there is nothing to discuss here, really, just derive from System.Windows.Forms.Control.

As you did not tell the declaration of slider (probably, some gibberish), I don't know why it does not compile; it should be Control, as the name of the Controls property suggests (is is that hard to read help?). I also don't believe this is real error message, as grammar looks broken. If you need some help, please be precise.

Look, even the name "System.Windows.Forms.Cntrols" is written in incorrect spelling; is it too hard to copy and paste? Who will be happy to answer when such attitude is manifested?

—SA
 
Share this answer
 
v3
Comments
Abhinav S 16-Feb-11 2:16am    
Simple enough. OP should be able to take it from there.
In addition to the first answer, this[^] discussion should also help you go to the right links.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 16-Feb-11 2:20am    
Same thing, 5, I'll add a bit to my answer.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900