//显示InputBox public static string ShowInputBox(string Title, string keyInfo) { ZeroInputBox inputbox = new ZeroInputBox(); inputbox.Text = Title; if (keyInfo.Trim() != string.Empty) { inputbox.lblInfo.Text = keyInfo; } inputbox.ShowDialog(); return(inputbox.txtData.Text); }
private void button_Click(object sender, System.EventArgs e) { // Microsoft. VisualBasic.Interaction.InputBox( "type your name ", "input ","",0,0); //可以将你要显示的文本信息代替下面的string.Empty。 string inMsg = ZeroInputBox.ShowInputBox("输入信息", string.Empty); //对用户的输入信息进行检查 if (inMsg.Trim() != string.Empty) { MessageBox.Show(inMsg); } else { MessageBox.Show("输入为string.Empty"); } }