473,410 Members | 1,857 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,410 software developers and data experts.

Font copy/paste issue ...

Hi Guys,

I have the following issue ...

I have a form with two richTextBoxes named

(01) richTextBox1
(02) richTextBox2

with some controls for selecting Font types (Arial, Courier, etc) and Font
size(s).

The text I enter in richTextBox1 gets copied (sent to) richTextBox2 upon
selecting a send button (provided in the form). Say, initially, I enter a
text (say, crazy)using a font (which is Courier, size = 10) and do a send.
The text "crazy" gets displayed in the richTextBox2 in the font that is
selected in the richTextBox1.

Now, I clear the richTextBox1 and enter a new text (say, language) using a
different font (which is Times New Roman, size 17) and do a send. Now the
text "language" gets appended to the earlier one "crazy" and gets displayed
as "crazylanguage". The displayed text is fine. The problem is with the
font.

I want the richTextBox2 to have the font of text "crazy" to be in the
Courier font with size = 10 and the newly appended text "language" to be in
the Times New Roman font with size = 17. But that is not what is happening.
The new text also, gets changed to the Courier font with size = 10.

I use the richTextBox2.Start position to calculate from where the new font
should be applicable and somehow it is not working. See the code below and
any help on this is appreciated.

PART OF THE CODE - BELOW
***************************
// Use the font selected from this in richTextBox2
// ***********************************
private void richTextBox1_TextChanged(object sender, System.EventArgs e)
{
fontUsed4CurrentText = richTextBox1.SelectionFont;
}

// On button send, copy the text from richTextBox1 to richTextBox2
// **************************************************
private void button1_Click(object sender, System.EventArgs e)
{
// Get the starting position for the new font to be applied
richTextBox2.SelectionStart += richTextBox2.TextLength;

// Get the length of the string to be copied
richTextBox2.SelectionLength = richTextBox1.TextLength;

// Set the font to be used for the copied/pasted text
richTextBox2.SelectionFont = fontUsed4CurrentText;

// The richTextBox1 text is appended to the existing text in
richTextBox2
richTextBox2.Text += richTextBox1.Text;

// The text entered in the richTextBox1 is cleared
// and the focus is set back to richTextBox1
richTextBox1.Text = "";
richTextBox1.Focus();
}

Expecting any help on this at the earliest. Thanks in advance. Let me know,
if you have any questions.

Regards,
Hariharan S

Nov 15 '05 #1
0 1384

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

Similar topics

8
by: François de Dardel | last post by:
I have a complete Intranet site with about 140 pages using Verdana as the basic font. How do I place a table (12 columns) with Arial instead of Verdana, only for that table. I have defined a style...
7
by: Sakharam Phapale | last post by:
Hi All, How to preserve the old font properties while changing new one? I posted same question 2 months back, but I had very small time then. eg. "Shopping for" is a text in RichTextBox and...
24
by: Tony Girgenti | last post by:
Hello. Developing a Windows Form program in VS.NET VB, .NET Framework 1.1.4322 on a windows XP Pro, SP2. Before printing a document, i want to set the font to a font that is only available...
8
by: Erwin Moller | last post by:
Hi group, I could use a bit of guidance on the following matter. I am starting a new project now and must make some decisions regarding encoding. Environment: PHP4.3, Postgres7.4.3 I must...
0
by: villagegreen | last post by:
I'm trying to use an html form to upload foreign language translations of English terms into a MySQL database. Since many different languages will be entered on the page, I have read that I should...
7
kcdoell
by: kcdoell | last post by:
Good morning everyone: I created a form and set the default view as a continuous form. Basically the form is displaying records in which the user can add or edit new ones. The record source for...
1
by: lrw0831 | last post by:
I have the main form where employees enter "issues". Some issues have fields that are the same. My fields are Issue ID (auto) Product Entered BY Issue Type Priority Request from Status...
6
by: lrw0831 | last post by:
I have the main form where employees enter "issues". Some issues have fields that are the same. My fields are Issue ID (auto) Product Entered BY Issue Type Priority Request from Status...
1
by: =?Utf-8?B?cG10N2Fy?= | last post by:
I have installed IME for writing in japanese. But the IME Pad Hand Writing doesnt work, i can draw, but in the lef box all the sugerences are white, are invisible, I have to mouseover them to see...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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...

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.