Click here to Skip to main content
15,891,597 members
Home / Discussions / C#
   

C#

 
QuestionNeed Typing Tutor Method / Examples Pin
M Riaz Bashir23-Nov-10 18:46
M Riaz Bashir23-Nov-10 18:46 
AnswerRe: Need Typing Tutor Method / Examples Pin
Keith Barrow23-Nov-10 21:49
professionalKeith Barrow23-Nov-10 21:49 
QuestionGet color value from array Pin
pancakeleh23-Nov-10 16:49
pancakeleh23-Nov-10 16:49 
AnswerRe: Get color value from array Pin
JF201523-Nov-10 18:25
JF201523-Nov-10 18:25 
GeneralRe: Get color value from array Pin
pancakeleh23-Nov-10 18:31
pancakeleh23-Nov-10 18:31 
GeneralRe: Get color value from array Pin
JF201523-Nov-10 18:37
JF201523-Nov-10 18:37 
GeneralRe: Get color value from array [modified] Pin
pancakeleh23-Nov-10 18:52
pancakeleh23-Nov-10 18:52 
GeneralRe: Get color value from array Pin
_Erik_24-Nov-10 3:48
_Erik_24-Nov-10 3:48 
Seeing the questions you have posted here in the last days, I think you have the bad habit of using ToString() method for everything, no matter if it is indeed a string, or a number, or a color, or whatever. If you want an array of colors, why do you declare a string[] array? Which is the type of the items you have in your ListBox? The string you are showing us ( Color[A=255, R= 255, G= 0, B= 0] ) is exactly what an object of Color type returns when you invoke its ToString() method so, how did you add the colors to the ListBox? Did you add the Color objects or did you also invoke ToString method to add them? I mean, if "c" object is a Color object, did you do this:

C#
ListBox.Items.Add(c);


Or did yo do this:

C#
ListBox.Items.Add(c.ToString());


I am asking becouse in both cases you would see the same result in the ListBox. However, in the first case the items are Color objects, so you only have to cast them to Color type:

C#
Color[] colors = listBox10.Items.Cast<Color>().ToArray();


But in the second case the problem is harder becouse you should parse each string. Summarizing, as a piece of advise, use ToString method only when you need a string object.
GeneralRe: Get color value from array [modified] Pin
pancakeleh24-Nov-10 16:11
pancakeleh24-Nov-10 16:11 
GeneralRe: Get color value from array [modified] Pin
_Erik_25-Nov-10 4:51
_Erik_25-Nov-10 4:51 
QuestionWhat Class(es) to use for Hardware Profiling? Pin
dpminusa23-Nov-10 15:48
dpminusa23-Nov-10 15:48 
AnswerRe: What Class(es) to use for Hardware Profiling? Pin
Not Active23-Nov-10 15:58
mentorNot Active23-Nov-10 15:58 
GeneralRe: What Class(es) to use for Hardware Profiling? Pin
dpminusa23-Nov-10 17:12
dpminusa23-Nov-10 17:12 
AnswerRe: What Class(es) to use for Hardware Profiling? Pin
Luc Pattyn23-Nov-10 16:25
sitebuilderLuc Pattyn23-Nov-10 16:25 
GeneralRe: What Class(es) to use for Hardware Profiling? Pin
dpminusa23-Nov-10 17:13
dpminusa23-Nov-10 17:13 
GeneralRe: What Class(es) to use for Hardware Profiling? Pin
Luc Pattyn23-Nov-10 17:25
sitebuilderLuc Pattyn23-Nov-10 17:25 
GeneralRe: What Class(es) to use for Hardware Profiling? Pin
dpminusa23-Nov-10 17:47
dpminusa23-Nov-10 17:47 
GeneralRe: What Class(es) to use for Hardware Profiling? Pin
Bernhard Hiller23-Nov-10 23:29
Bernhard Hiller23-Nov-10 23:29 
GeneralRe: What Class(es) to use for Hardware Profiling? Pin
dpminusa24-Nov-10 0:16
dpminusa24-Nov-10 0:16 
AnswerRe: What Class(es) to use for Hardware Profiling? Pin
dpminusa23-Nov-10 17:18
dpminusa23-Nov-10 17:18 
GeneralRe: What Class(es) to use for Hardware Profiling? Pin
Jacob D Dixon23-Nov-10 17:53
Jacob D Dixon23-Nov-10 17:53 
GeneralRe: What Class(es) to use for Hardware Profiling? Pin
dpminusa23-Nov-10 19:48
dpminusa23-Nov-10 19:48 
GeneralRe: What Class(es) to use for Hardware Profiling? Pin
Jacob D Dixon24-Nov-10 8:22
Jacob D Dixon24-Nov-10 8:22 
GeneralRe: What Class(es) to use for Hardware Profiling? Pin
dpminusa24-Nov-10 15:17
dpminusa24-Nov-10 15:17 
GeneralRe: What Class(es) to use for Hardware Profiling? Pin
Jacob D Dixon26-Nov-10 3:56
Jacob D Dixon26-Nov-10 3:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.