public string GetInputText(string description, string caption) { var view = new InputTextBox(description, caption); view.ShowDialog(); return(view.ReturnedText); }
private void button3_Click(object sender, EventArgs e) { string[] randomText = Resources.ResourceManager.GetObject("LoremIpsum").ToString().Split('.'); List <CustomMessageBoxButton> buttons = new List <CustomMessageBoxButton>(); for (int j = 0; j < 10; j++) { string textValue = StaticRandomizer.RandomInt(0, 10) > 6 ? randomText[StaticRandomizer.RandomInt(0, randomText.Length - 1)] : ""; buttons.Clear(); int buttonCount = StaticRandomizer.RandomInt(1, 5); for (int i = 0; i < buttonCount; i++) { buttons.Add(new CustomMessageBoxButton(CustomButtonResult.Button1, randomText[StaticRandomizer.RandomInt(0, randomText.Length - 1)].Trim().Split(' ').FirstOrDefault())); } using (InputTextBox customMessageBox = new InputTextBox(textValue, randomText[StaticRandomizer.RandomInt(0, randomText.Length - 1)], "CustomMessageBox Demo", buttons.ToArray(), StaticRandomizer.RandomInt(1, buttonCount)) { StartPosition = FormStartPosition.CenterParent }) { customMessageBox.VerificationText = StaticRandomizer.RandomInt(0, 10) > 6 ? randomText[StaticRandomizer.RandomInt(0, randomText.Length - 1)] : ""; customMessageBox.ShowDialog(); } } }
public string GetUserInput(string hint) { InputTextBox inputDialog = new InputTextBox(); inputDialog.Title = hint; inputDialog.ShowDialog(); return(inputDialog.Result); }