I wrote this code:
string FindWord(string specificWord)
{
string[] words = textBox1.Text.Split(' ');
for (var i = 0; i < words.Length; i++)
{
if ((words[i] == specificWord) && (i < (words.Length - 1)))
{
return words[i + 1];
}
}
return "";
}
void ProcessData()
{
string result = FindWord("test");
if (result != "")
{
try
{
Clipboard.SetText(result);
}
catch (Exception x)
{
MessageBox.Show("Error copying " + result + " to clipboard.\n\n" + x);
}
}
}
void Button1Click(object sender, EventArgs e)
{
ProcessData();
}
So far, it works.