John Skeet's Example

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Using this example by John Skeet, how can I get a messagebox to show the word? I have an event for when I want it to show, all I have to do is put in MessageBox.Show("WORD HERE")

string GetWord(

if (rtb.TextLength==0

return ""


string text = rtb.Text

int end = rtb.SelectionStart
int start = text.LastIndexOf (' ', end)
if (start==-1

start = 0

return text.Substring (start, end-start)
 
Not sure what this is for, but as long as you have a reference set the
System.Windows.Forms (which is where MessageBox lives)
you should be able to do this:

MessageBox.Show(GetWord());

--Hope that helps

Peter

Bill English said:
Using this example by John Skeet, how can I get a messagebox to show the
word? I have an event for when I want it to show, all I have to do is put
in MessageBox.Show("WORD HERE");
 
Back
Top