我想问一下,弹出的Form1窗口,是不是Form1类的对象,既然是对象,怎么没见到new Form1的代码呢?

解决方案 »

  1.   

    当然是了,new Form1() 在 Program.cs 里, Application.Run(new Form1());
      

  2.   

    当然是。给lz留一个思考题。Application 没看见 new 在哪里,它是对象么?
      

  3.   

    C# 就是面向对象的编程,所有的对象当然要实例化了  也就是  new
    你看不到,不代表没有,1楼正解, 程序入口已经实例化类 ,一个对象要在其他 类或对象里 实例化 才可以显示出来,
      

  4.   

    存入SqlConnection con = new SqlConnection("Server=Darkover;uid=<username>;pwd=<strong password>;database=northwind");
    SqlDataAdapter da = new SqlDataAdapter("Select * From MyImages", con);
    SqlCommandBuilder MyCB = new SqlCommandBuilder(da);
    DataSet ds = new DataSet("MyImages");da.MissingSchemaAction = MissingSchemaAction.AddWithKey;
    FileStream fs = new FileStream(@"C:\winnt\Gone Fishing.BMP", FileMode.OpenOrCreate, FileAccess.Read);
                
    byte[] MyData= new byte[fs.Length];
    fs.Read(MyData, 0, System.Convert.ToInt32(fs.Length));
                
    fs.Close();
                
    da.Fill(ds,"MyImages");
                    
    DataRow myRow;
    myRow=ds.Tables["MyImages"].NewRow();myRow["Description"] = "This would be description text";
    myRow["imgField"] = MyData;
    ds.Tables["MyImages"].Rows.Add(myRow);
    da.Update(ds, "MyImages");con.Close();