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");
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top