私はWindows.Formsアプリケーションを持っています。ボタンがあるメニューバーがあります。そのボタンをクリックすると、別のフォームが開きます( "CustomMessageBox")。同じプロジェクトに2つのCustomMessageBoxがあります
このCustomMessageBoxは、リストビュー、少数RichTextBoxes、いくつかのラベルといくつかのボタンがあります。それは、ほんのちょうどリストにデータを追加するためのフォームです。すべての井戸と良い、意図どおりに動作します。
ここでは、現在のCustomMessageBoxためのコードです:
namespace CustomMessageBoxNS {
public partial class CustomMessageBox : Form {
static Dictionary<string, string> currentDictionary;
static CustomMessageBox MyBox;
static ListView macroList;
static Form thisWindow;
static Label firstLabel;
static Label secondLabel;
public CustomMessageBox() {
InitializeComponent();
macroList = cmb_lb_macroList;
firstLabel = cmb_lbl_name;
secondLabel = cmb_lbl_action;
thisWindow = this;
}
public static Dictionary<string, string> Show(Dictionary<string, string> inData, string title, string label1, string label2) {
MyBox = new CustomMessageBox();
currentDictionary = inData;
thisWindow.Text = title;
firstLabel.Text = label1;
secondLabel.Text = label2;
updateListBox();
MyBox.ShowDialog();
return currentDictionary;
}
//Plus a whole bunch of other methods which aren't relevant for my question.
}
}
CustomMessageBoxは、次のように使用されている:それをやって
macroDictionary = CustomMessageBox.Show(macroDictionary, "Edit Macros", "Name:", "Macro:");
は通常のメッセージボックス、奇妙な何もないようCustomMessageBoxを示しています。
私の問題: 別のCustomMessageBoxを作成したかったのですが、現在のものとはまったく違って見えました(他のコントロール)。Add - > Existing Item - > CustomMessageBoxプロジェクトを参照 - >クラスを選択ファイル。しかし、私がそれをインポートしたとき、私はエラーの全体の束を得ました。 「同じもののうちの2つを」持つことで、彼らは衝突した。私は何例それを知らないとき
それはそれを記述することは困難です。私の推測では、同じプロジェクトで2つのクラスを同じ「パブリック部分クラスCustomMessageBox:Form」にすることはできないと思います。
私は一揃いのエラーを受け取りますが、以下の方法または特性の間にある。
今、私はので、私は「同じの2を、しかし異なる」ことができます修正することができますどのようにだろうか?
クラスの名前を変更するだけですか? – orhtej2
新しいクラスに別の名前を付けるか、別の名前空間に配置します。 – mm8
2つの異なるものがある場合は、一般に異なる名前を付けることが一般的に予想されます。 – David