添加引用,System.Windows.Forms.dll

解决方案 »

  1.   

    WinForms是what?????当然是using System.Windows.Forms;
      

  2.   

    那怎么在Form1中输出数据呢?好多方法都没有。
    不知道怎么搞的。有哪位大侠写一个简单的程序
    给我看看,感激不尽。下面是我的程序:
    using System;
    using System.Drawing;
    using System.Collections;
    using System.ComponentModel;
    using System.Windows.Forms;//我的书上写的是System.WinForms命名空间namespace WindowsApplication1
    {
    public class Form1 : System.Windows.Forms.Form
    {
    private System.ComponentModel.Container components;
    private ListBox listBox1;
    private int nltems=0;
    public void Addltem(string sltem)
    {
    object oltem=sltem;
    listBox1.InserItem(nltems,oltem);
    ++nltems;
    }
    public Form1()
    {

           InitializeComponent();
    Addltem("An item of output");
    Addltem("2nd bit of output");
    Addltem("More output");
                       }
    static void Main() 
    {
    Application.Run(new Form1());
    }
    }
    }
    编绎时listbox1中没有 InserItem和InitializeComponent() 方法。
      

  3.   

    看看你的书是不是两年前出的?
    那是Beta1时的 namespace,Beta2开始就改了
    找本新点的书看吧,费了一本书好过费时间啊
      

  4.   

    是呀,学.NET最好就不能"吝啬",最好看2002年以后出版的,要不然会吃很多苦头的哟:)。