I have having a bit of trouble with the following code snippet:
Java |
How do I make the proper assignment here? I am in the process of learning C#. Thanks.
Java |
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
theLizardRank #1,079 · 1.8K reputationPosted Oct 15, 2010, 1:34 PM EDT
Icon colIcon = new Icon(); colIcon = (Icon)rm.GetObject("check-green.ico"); // Line Throws a Object reference not set to an instance of an object. ErrorShawn Simmons9 reputationPosted Oct 15, 2010, 1:46 PM EDT
new Icon() won't work because the Icon class will not allow an empty constructor. It is expecting a string constructor.
Shawn