0
我目前正在嘗試訪問我在form2中的form1中創建的二叉搜索樹。我的第一種形式的代碼是:在窗體之間傳遞二進制搜索樹
public Home() {
InitializeComponent();
}
AddArtist secondForm = new AddArtist();
BSTree<Artist> ArtistCollection = new BSTree<Artist>();
private void btnAdd_Click(object sender, EventArgs e) {
secondForm.ShowDialog();
}
我的第二種形式的代碼是:
private void btnDone_Click(object sender, EventArgs e) {
string artistName = txtName.Text;
Artist newArtist = new Artist(artistName);
ArtistCollection.InsertItem(artistName);
this.DialogResult = DialogResult.OK;
}
我已經試過了自己的類,所以沒有結果中聲明它的方法。