代码如下:
private GetsubDirectories(TreeNode parent)
{
   DirectoryInfo directory;
try
{
if(parent.Nodes.Count==0)
{
directory = new DirectoryInfo (parent.FullPath );
foreach(DirectoryInfo dir in directory.GetDirectories)
{
TreeNode newNode = new TreeNode (dir.Name );
parent.Nodes.Add(newNode);
}
foreach(TreeNode node in Parent.Nodes )
{
if (node.Nodes.Count ==0)
{
directory =new DirectoryInfo (node.FullPath );                  foreach(DirectoryInfo dir in directory.GetDirectories())
{
TreeNode newNode = new TreeNode (dir.Name );
node.Nodes.Add (newNode);
}
}
}
}
   }

catch
{
   return;
}
}
提示有如下错误:
D:\vs.net项目\应用程序\高级控件示例\TabControlExample.cs(336): 类、结构或接口方法必须有返回类型
不知道是哪里出了错..

解决方案 »

  1.   

    what are you returning? if nothing, tryprivate void GetsubDirectories(TreeNode parent)
      

  2.   

    函数名前居然不加返回类型啊,至少加个void嘛.........
      

  3.   

    其实在编译之前像这些低级的错误,VS IDE就能自动有提示功能,比如有红色的小浪线等,楼主为什么先看看呢
      

  4.   

    private GetsubDirectories(TreeNode parent)
    改成
    private void GetsubDirectories(TreeNode parent)
      

  5.   

    我也是个新手,可楼主的错误确实比较低级。
    我建议你上微软的网站上下些webcast 学习一下,打基础很重要的!
    http://www.microsoft.com/china/msdn/events/webcasts/shared/webcast/consyscourse/Modern.aspx