473,493 Members | 4,319 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Format text in a messagebox

Hi i have a messagebox like so.

MessageBox.Show(mystring);

I would like to highlight each occurance of the word "and" in the
messagebox. How do I tell the messagebox to highlight each occurance of
the word and, in the string mystring that it is displaying?

Thanks,

Gary.

Nov 28 '06 #1
6 13279
Hello,
I think it's not possible.
You can build your own MessageBox...

Nov 28 '06 #2
You write your own MessageBox implementation.

--
HTH,

Kevin Spencer
Microsoft MVP
Virtual Carpenter
http://unclechutney.blogspot.com

Paranoia is a state of mind.
<ga********@myway.comwrote in message
news:11**********************@j44g2000cwa.googlegr oups.com...
Hi i have a messagebox like so.

MessageBox.Show(mystring);

I would like to highlight each occurance of the word "and" in the
messagebox. How do I tell the messagebox to highlight each occurance of
the word and, in the string mystring that it is displaying?

Thanks,

Gary.

Nov 28 '06 #3
Ah so the functionality isn't within the messagebox itself.

I haven't written my own implementations of common controls yet. Could
you offer any advice please, as I'm a novice.

Many Thanks,

Gary.

Kevin Spencer wrote:
You write your own MessageBox implementation.

--
HTH,

Kevin Spencer
Microsoft MVP
Virtual Carpenter
http://unclechutney.blogspot.com

Paranoia is a state of mind.
<ga********@myway.comwrote in message
news:11**********************@j44g2000cwa.googlegr oups.com...
Hi i have a messagebox like so.

MessageBox.Show(mystring);

I would like to highlight each occurance of the word "and" in the
messagebox. How do I tell the messagebox to highlight each occurance of
the word and, in the string mystring that it is displaying?

Thanks,

Gary.
Nov 28 '06 #4
you must create a form who will have the same look as the MessageBox.
with 1 Richtextbox for the text you want to display, 2 buttons (OK and
cancel).
In your form, you write a function like:

public void show (string msg, string Highlighttext, Color c)
{
this. Richtextbox.text = msg;

// here comes the function to find and highlight text
// Richtextbox has functions like Find, SelectionColor,...
// example in VB At: http://support.microsoft.com/kb/154884

this. Showdialog ();
}

Voila...

Nov 28 '06 #5
I haven't written my own implementations of common controls yet. Could
you offer any advice please, as I'm a novice.
I would do a google search for "c# inherit form controls" or something
of the like. There is lots of information out there to get you started.
Ultimately, you will need to write your own class that inherits the
functionality of the MessageBox class. For example:

using System.Windows.Forms;

public class MyMessageBox : MessageBox
{
....
}

You may also want to read up on overriding base class functions. I hope
that helps.

Best Regards,
Tyson Comer

Nov 28 '06 #6
Ultimately, you will need to write your own class that inherits the
functionality of the MessageBox class. For example:

using System.Windows.Forms;

public class MyMessageBox : MessageBox
{
...
}
Please note that this will not work since the MessageBox class has only one
static method to perform all the logic - show a message box. It is not
designed to be inherited.
Nov 28 '06 #7

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

Similar topics

4
3206
by: ZZZ | last post by:
this code : try { DataSet dsDeurprijs = new DataSet(); SqlDataAdapter sqlDeurprijs = new SqlDataAdapter("Select
7
5278
by: Esteban404 | last post by:
I've tried many conversions to get the values to be accepted, but none are working and the subject error message is returned for Parse and ToInt32. I haven't figured out what "format" is wrong. I'm...
5
9442
by: ramonred | last post by:
Hi All, this is the error: Input string was not in a correct format. this is the code I am trying to debug: <code> string sql = @" INSERT INTO (UserID, Login, Password, FirstName, LastName,...
3
7406
by: Sin | last post by:
I'm currently evaluating VC.NET as the new platform for the company I work for and things are looking grim... We're up against another IDE which took me about 5 minutes to master and I've been...
7
6731
by: jez123456 | last post by:
Hi, I have the following method where I need to display which database is being processed, however, the label lblDatabase dosn't seem to work until the end. private void...
1
1832
by: Neo | last post by:
I have a table Contacts with a field "Male" which is of type Bit (SQL Server). I've got two radio buttons in a panel, & one of them is bound to the above field, (so that one can see if the contact...
0
876
by: Neo | last post by:
I have a table Contacts with a field "Male" which is of type Bit (SQL Server). I've got two radio buttons in a panel, & one of them is bound to the above field, (so that one can see if the...
4
2516
by: krishp | last post by:
Hi, I need to convert raw data recieved from a device through C#.Net socket to BMP format. For some reason the image conversion is not happening proparly and I can see only blur image . ...
7
13609
by: Andrus | last post by:
How to create format string for decimal data type which shows blank for zero and default format otherwize ? I tried format string "f;f;#" but this shows f for nonzero numbers. Andrus. ...
0
6980
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
5452
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4886
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4579
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3087
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3078
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1397
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
282
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.