Как получить результаты inputbox в строке
Я добавил поле ввода в свой проект, добавив ссылку на visual basic.
но теперь я не знаю, как получить его результат, сохраненный в строке, чтобы, когда пользователь нажимает кнопку ok на этом поле ввода, он находит этот конкретный соответствующий результат.
Кроме того, будет очень полезно, если вы подскажете мне, как настроить кнопку инструмента на поиск слов только в том случае, если пользователь нажмет кнопку ok
Что я уже пробовал:
private void findToolStripMenuItem_Click(object sender, EventArgs e) { Microsoft.VisualBasic.Interaction.InputBox("Enter Word to Search for", "Find",""); int value = 0; string temp = Getnew().Text; Getnew().Text = ""; Getnew().Text = temp; while(value<Getnew().Text.LastIndexOf("should contain the string variable with results of inputbox")) { // searches the text in richtextbox Getnew().Find("should contain the string variable with results of inputbox", value, Getnew().TextLength, RichTextBoxFinds.None); //selection colour added automatically when match is found Getnew().SelectionBackColor = Color.LightYellow; // continue searching for words value = Getnew().Text.IndexOf(Getnew().Text, value) + 1; }