如何从TreeNode派生

如何从TreeNode派生

本文介绍了如何从TreeNode派生?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,


我仍​​然是C#的新手,并且想从

TreeNode派生来扩展TreeNode类。这是测试程序:




我在第0077行收到错误说:


"发生了'System.InvalidCastException'类型的未处理异常
inheritance.exe中的



附加信息:已指定演员无效。


请帮助,谢谢。


-

Mark Allison,SQL服务器MVP



寻找SQL Server复制书?

Hi there,

I''m still very much a newbie to C#, and would like to derive from
TreeNode to extend the TreeNode class. Here''s test program:

http://www.vkarlsen.no/pastebin/default.asp?id=4090

I get an error on line 0077 saying:

"An unhandled exception of type ''System.InvalidCastException'' occurred
in inheritance.exe

Additional information: Specified cast is not valid."

Please help, thanks.

--
Mark Allison, SQL Server MVP
http://www.markallison.co.uk

Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602m.html

推荐答案




你正在添加一个TreeNodeEx,还有一个直的TreeNode - 和

,这是在tvwTest_AfterSelect中立即使用的那个。


-

Jon Skeet - < sk *** @ pobox.com>


如果回复该群组,请不要给我发邮件



You''re adding one TreeNodeEx, but also one straight TreeNode - and
that''s the one which is immediately being used in tvwTest_AfterSelect.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too






这篇关于如何从TreeNode派生?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-16 04:56