Hi,
ich habe folgendes Inputboxprogramm(Kritik erwünscht) geschrieben, aber wenn ich aus einem anderen Projekt auf den Namespace Input verweise wird mir angezeigt, das dieser nicht existiert. Was hab ich falsch gemacht?
Gruß Didi
ich habe folgendes Inputboxprogramm(Kritik erwünscht) geschrieben, aber wenn ich aus einem anderen Projekt auf den Namespace Input verweise wird mir angezeigt, das dieser nicht existiert. Was hab ich falsch gemacht?
Code:
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 Input
{
public enum States
{
OK,
Abort,
Error,
}
class InputBox : Form
{
public static States Status;
public static string Output;
public InputBox(string Name, string Text)
{
InitializeComponent();
this.Text = Name;
lblText.Text = Text;
}
public static void Shows(string Name, string Text)
{
InputBox Box = new InputBox(Name,Text);
Box.ShowDialog();
}
private void btnOK_Click(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(txtInput.Text))
{
Status = States.OK;
Output = txtInput.Text;
}
else
Status = States.Abort;
this.Close();
}
private void btnAbort_Click(object sender, EventArgs e)
{
Status = States.Abort;
this.Close();
}
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
this.lblText = new System.Windows.Forms.Label();
this.btnOK = new System.Windows.Forms.Button();
this.btnAbort = new System.Windows.Forms.Button();
this.txtInput = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// lblText
//
this.lblText.AutoSize = true;
this.lblText.Location = new System.Drawing.Point(9, 15);
this.lblText.Name = "lblText";
this.lblText.Size = new System.Drawing.Size(46, 13);
this.lblText.TabIndex = 0;
this.lblText.Text = "Ein Text";
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(248, 15);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 1;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnAbort
//
this.btnAbort.Location = new System.Drawing.Point(248, 44);
this.btnAbort.Name = "btnAbort";
this.btnAbort.Size = new System.Drawing.Size(75, 23);
this.btnAbort.TabIndex = 2;
this.btnAbort.Text = "Abbrechen";
this.btnAbort.UseVisualStyleBackColor = true;
this.btnAbort.Click += new System.EventHandler(this.btnAbort_Click);
//
// txtInput
//
this.txtInput.Location = new System.Drawing.Point(12, 90);
this.txtInput.Name = "txtInput";
this.txtInput.Size = new System.Drawing.Size(314, 20);
this.txtInput.TabIndex = 3;
//
// FrmBox
//
this.AcceptButton = this.btnOK;
this.ClientSize = new System.Drawing.Size(338, 122);
this.Controls.Add(this.txtInput);
this.Controls.Add(this.btnAbort);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.lblText);
this.Name = "FrmBox";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label lblText;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnAbort;
private System.Windows.Forms.TextBox txtInput;
}
}
Gruß Didi