在Form2.cs[设计]中已经设计好窗体。
在Form2.cs中代码如下:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;namespace WindowsApplication2
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {        }        private void button1_Click(object sender, EventArgs e)
        {
           listBox_Book.Items.Add("书名:" + textBox_Bookname.Text + ",出版社:" + comboBox_Publishing.Text);
           textBox_Bookname.Text = "";        }        private void button2_Click(object sender, EventArgs e)
        {
            if (listBox_Book.SelectedIndex != -1)
            {
                listBox_Book.Items.Remove(this.listBox_Book.SelectedItem);
            }        }        private void textBox_Bookname_TextChanged(object sender, EventArgs e)
        {        }        private void comboBox_Publishing_SelectedIndexChanged(object sender, EventArgs e)
        {        }
    }
}
为什么F5运行后出现的却是空白的窗体?就是新建Windows项目初始化的那种窗体。

解决方案 »

  1.   

    确认启动窗体是Form2不是Form1,或者控件是否可见
      

  2.   

    确认Program类中Application.Run(new Form2());
      

  3.   


            static void Main()
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new Form1());
            }
      

  4.   

    看看你的program.cs文件里面的main函数,Application.Run里面运行的是不是Form2的实例。