Click here to Skip to main content
15,913,090 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to save drawing from picture box drawn in GDI+ into bmp file type? Pin
leppie13-Mar-08 8:33
leppie13-Mar-08 8:33 
AnswerRe: How to save drawing from picture box drawn in GDI+ into bmp file type? Pin
Skippums13-Mar-08 6:55
Skippums13-Mar-08 6:55 
GeneralRe: How to save drawing from picture box drawn in GDI+ into bmp file type? Pin
yuenli13-Mar-08 13:43
yuenli13-Mar-08 13:43 
GeneralRe: How to save drawing from picture box drawn in GDI+ into bmp file type? Pin
KaptinKrunch13-Mar-08 17:11
KaptinKrunch13-Mar-08 17:11 
GeneralEditing ComboBox with DataSource Pin
polishprogrammer13-Mar-08 5:44
polishprogrammer13-Mar-08 5:44 
GeneralToolbox icon for user control Pin
hain13-Mar-08 5:25
hain13-Mar-08 5:25 
GeneralRe: Toolbox icon for user control Pin
led mike13-Mar-08 5:37
led mike13-Mar-08 5:37 
GeneralRe: Toolbox icon for user control Pin
hain13-Mar-08 5:44
hain13-Mar-08 5:44 
GeneralRe: Toolbox icon for user control Pin
led mike13-Mar-08 6:05
led mike13-Mar-08 6:05 
GeneralRe: Toolbox icon for user control [modified] Pin
hain13-Mar-08 6:17
hain13-Mar-08 6:17 
GeneralRe: Toolbox icon for user control Pin
led mike13-Mar-08 8:16
led mike13-Mar-08 8:16 
GeneralRe: Toolbox icon for user control Pin
leppie13-Mar-08 8:30
leppie13-Mar-08 8:30 
GeneralRe: Toolbox icon for user control Pin
hain13-Mar-08 10:17
hain13-Mar-08 10:17 
GeneralRe: Toolbox icon for user control Pin
hain13-Mar-08 10:20
hain13-Mar-08 10:20 
GeneralUnable to connect to Web Service Pin
Manoj Sethi13-Mar-08 5:01
Manoj Sethi13-Mar-08 5:01 
GeneralRe: Unable to connect to Web Service Pin
Muhammad Gouda13-Mar-08 5:04
Muhammad Gouda13-Mar-08 5:04 
GeneralRe: Unable to connect to Web Service Pin
James J. Foster13-Mar-08 6:46
James J. Foster13-Mar-08 6:46 
GeneralRe: Unable to connect to Web Service Pin
Skippums13-Mar-08 6:46
Skippums13-Mar-08 6:46 
GeneralRe: Unable to connect to Web Service Pin
leppie13-Mar-08 10:57
leppie13-Mar-08 10:57 
GeneralErrors with typecasting Pin
Leo Smith13-Mar-08 4:55
Leo Smith13-Mar-08 4:55 
Hello,

I am having problems with a tree control in a windows form application. Sometime yesterday a typecast that I was using wuit functioning and I can't figure out where the problem started. I have a class that is an extents the System.Windows.Forms.TreeNode class. It adds fine to the TreeControl, but when I go back and try to read the object and cast it as the new class it throws the following exception. What could have happened to make this start failing? I am including the adding and the locating a node. The adding program sometimes throws a duplicate value, which is tested by the FindChildNode before adding it. The FindChildNode is the biggest problem right now and is throwing the following Exception (Bolded line is throwing the error).

Message="Unable to cast object of type 'System.Windows.Forms.TreeNode' to type 'InternalApp.ECDTreeNode'."

<br />
public class ECDTreeNode : System.Windows.Forms.TreeNode<br />
{<br />
.<br />
.<br />
.<br />
   public ECDTreeNode FindChildNode(string cText)<br />
   {<br />
      ECDTreeNode ret = null;<br />
      for (int i = 0; i < Nodes.Count; i++)<br />
      {<br />
         ECDTreeNode tn = (ECDTreeNode)Nodes[i];<br />
         if (cText.Trim().ToLower().CompareTo(tn.Text.Trim().ToLower()) == 0)<br />
         {<br />
            ret = tn;<br />
            break;<br />
         }<br />
      }<br />
      return ret;<br />
      }<br />
   }<br />
   public void AddSorted(ECDTreeNode tn)<br />
   {<br />
      bool bFound = false;<br />
      try<br />
      {<br />
         for (int i = 0; i < Nodes.Count; i++)<br />
         {<br />
            if (tn.Text.CompareTo(Nodes[i].Text) < 0)<br />
            {<br />
               Nodes.Insert(i, tn.Text.Trim());<br />
               bFound = true;<br />
               break;<br />
            }<br />
         }<br />
         if (!bFound)<br />
            Nodes.Add(tn);<br />
     }<br />
     catch (Exception e) <br />
     {<br />
        MessageBox.Show(e.Message, "Exception Error", <br />
             MessageBoxButtons.Ok, MessageBoxIcon.Error);<br />
     }<br />
   }<br />
<br />
}<br />
<br />


Thanks for any help,

Leo T. Smith
Program/Analyst Supervisor

GeneralRe: Errors with typecasting Pin
Gareth H13-Mar-08 5:04
Gareth H13-Mar-08 5:04 
GeneralRe: Errors with typecasting Pin
Leo Smith13-Mar-08 6:00
Leo Smith13-Mar-08 6:00 
GeneralRe: Errors with typecasting Pin
Skippums13-Mar-08 6:39
Skippums13-Mar-08 6:39 
GeneralRe: Errors with typecasting Pin
Gareth H13-Mar-08 6:47
Gareth H13-Mar-08 6:47 
GeneralRe: Errors with typecasting Pin
Skippums13-Mar-08 7:38
Skippums13-Mar-08 7:38 

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.