473,386 Members | 1,962 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

John Skeet's Example

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)
Nov 16 '05 #1
2 1139
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" <nu****@comcast.net> wrote in message
news:A4**********************************@microsof t.com...
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);
}

Nov 16 '05 #2
Thanks
Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Sjoerd Mulder | last post by:
Hi all, I have a database storing persons and the groups they belong to. I therefore created three tables, a group table, person table and join table. I have for example the next tables: ...
22
by: Marina | last post by:
Hi, Consider the following situation I have the following routine running repeatedly (curControl is a UserControl with say 1000 textboxes and a big array of strings): Public Sub...
1
by: Alen Gurovic | last post by:
hello john i did not saw your messgae Now i want to set secret key but i do not know how need help with that code In sub crypt encrypt text and that is ok I don't know how to set .key...
31
by: AlexeiOst | last post by:
Everywhere in documentation there are recommendations to use threads from thread pooling for relatively short tasks. As I understand, fetching a page or multiple pages (sometimes up to 50 but not...
383
by: John Bailo | last post by:
The war of the OSes was won a long time ago. Unix has always been, and will continue to be, the Server OS in the form of Linux. Microsoft struggled mightily to win that battle -- creating a...
9
by: Anders Borum | last post by:
Hello! I have a class that needs to validate the input value, when a programmer changes a specific property on a class. The input should only accept the following pattern {1,n} (alpha-numeric...
7
by: Marc Pelletier | last post by:
Hello, I am still fairly new to CSharp and am trying to implement a singleton pattern. I found Jon Skeet's excellent page (http://www.yoda.arachsys.com/csharp/singleton.html), but am struggling...
1
by: Michael C | last post by:
Something you said the other day, about hiding an asynchronous Invoke of a UI control in a property, stuck with me. Can you point me to an example of this? BTW - I'm about 1/4th of the way...
44
by: Mantorok | last post by:
Hi all We are an organisation that use C# currently and we have some members who are not yet trained in .Net or C#, some staff have requested they use VB instead (probably due to their...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.