2
我正在嘗試創建一個multiWindowsForm
。多個表單不顯示
只是嘗試它是如何工作的,我開始使用一個簡單的表單,我添加了一個按鈕。點擊它時,會彈出另一個窗口。但我無法讓它工作。它與錯誤崩潰:
Object reference not set to an instance of an object!
我用項目 → 添加 → Windows窗體並把它命名爲Mupp.cs
這裏是我的Form1.cs
代碼:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MultiForm
{
public partial class tryout : Form
{
public tryout()
{
InitializeComponent();
}
Mupp theMupp;
private void Form1_Load(object sender, EventArgs e)
{
theMupp = new Mupp();
}
private void button1_Click(object sender, EventArgs e)
{
theMupp.Show();
}
}
}
我能錯過了嗎?
發佈您的Mupp類的代碼。另外,它會在'theMupp.Show()'或Mupp類本身的某個地方崩潰嗎? –
當你新增你的Mupp類時,你可能會遇到問題。我們需要看代碼。 –
我沒有用Mupp.cs代碼編輯帖子。謝謝!〜 –