473,791 Members | 3,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Regarding richtextbox control in vb.net

Hello,

I need to implement an email editor control in my application.

The control should allow me to type in text in any format,font etc.
This i have managed using the richtextbox control available with .NET.

As the email textbox can include the embedded images I want to provide
this functionality in it.
Now the next stuff is I want to prepare an html file from this all the
data I have typed in a richtextbox control. How is it prossible?

I have written a parser which successfully converts rtf text data into
proper html but if we have to insert an image then how should I
proceed how am I supposed to know that from a perticular location
image is staretd and from where it is loaded in richtextbox

This is my code which converts the formatted text into html file

Private Function ConvertHtml(ByV al Box As RichTextBox) As String
Dim converted As String = ""
Dim charCnt, cnt As Long

Dim fontSize As String
Dim fontColor As String
Dim fontName, toApplyString As String
Dim isBold, isItalic, isUnderline, isBullet, isStrikeOut As
Boolean

Console.WriteLi ne(Now.ToString )
Dim fontstring As String = "<li><strike><u ><i><b><font
color=""fcolor" " size=""fsize"" face=""fface""> char</font></b></i></
u></strike></li>"

arrayOfBullets. Clear()
ReadLines()

For charCnt = 1 To Box.Text.Length
toApplyString = fontstring
Box.Select(char Cnt - 1, 1)
cnt = charCnt - 1

isBullet = Box.SelectionBu llet
isBold = Box.SelectionFo nt.Bold
isItalic = Box.SelectionFo nt.Italic
isUnderline = Box.SelectionFo nt.Underline
isStrikeOut = Box.SelectionFo nt.Strikeout()

If Box.SelectionCo lor.ToKnownColo r 0 Then
fontColor = Box.SelectionCo lor.Name
Else
fontColor = "#" & Hex(Box.Selecti onColor.R) &
Hex(Box.Selecti onColor.G) & Hex(Box.Selecti onColor.B)
End If

fontSize = Box.SelectionFo nt.Size.ToStrin g
fontName = Box.SelectionFo nt.Name.ToStrin g

If arrayOfBullets. Contains(Long.P arse(cnt)) Then
If Not isBullet Then
toApplyString = toApplyString.R eplace("<li>",
"").Replace ("</li>", "")
End If
Else
toApplyString = toApplyString.R eplace("<li>",
"").Replace ("</li>", "")
End If

If Not isBold Then
toApplyString = toApplyString.R eplace("<b>",
"").Replace ("</b>", "")
End If

If Not isStrikeOut Then
toApplyString = toApplyString.R eplace("<strike >",
"").Replace ("</strike>", "")
End If

If Not isItalic Then
toApplyString = toApplyString.R eplace("<i>",
"").Replace ("</i>", "")
End If

If Not isUnderline Then
toApplyString = toApplyString.R eplace("<u>",
"").Replace ("</u>", "")
End If

converted = String.Format(" {0}{1}", converted,
toApplyString.R eplace("fcolor" , fontColor).Repl ace("fsize",
fontSize).Repla ce("fface", fontName).Repla ce("char",
Box.Text.Substr ing(charCnt - 1, 1)).Replace(Con vert.ToChar(10) ,
"<br>"))
Next

Console.WriteLi ne(Now.ToString )
Return "<html>" & converted & "</html>"
End Function

the function returns an changed html content. But how to get the
information about pictures.

An rtf to html is also wel comed Currently I am not getting anything
which could help me

Regards,

A. Shivaranjani

Jun 11 '07 #1
0 3451

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

Similar topics

1
2585
by: vanvee | last post by:
Hi I have a user control that contains a RichTextBox in vb.net. In my program, I create multiple instances of this control (with the RichTextBox being in each one), that appear one above the other on a panel. The problem is that each control may have varying amounts of data, and so each RichTextBox (within each control) needs to size to fit the amount of text within that RichTextBox. I've tried multiplying the size of a single line...
1
2498
by: Nathan Carroll | last post by:
In an mdi environment I constructed a child for with a richtextbox control that is used to load .rtf's. This works fine on the intiatial load of the form but when for is closed and reopened later I get: System.ObjectDisposedException: Cannot access a disposed object named "RichTextBox". Object name: "RichTextBox". at System.Windows.Forms.Control.CreateHandle() at System.Windows.Forms.TextBoxBase.CreateHandle() at...
0
1667
by: Brian Scott | last post by:
I am currently trying to control the syntax highlighting of a richtextbox control whilst the user types. At the moment I have implemented a thread which calls the richTextBox.Invoke on a method that parses each line of the richTextBox and highlights specific words with a given color. I have been highlighting each of the words by using the Select method and changing the selection color beforehand. This works fine until the contents of the...
2
30534
by: Neo Chou | last post by:
Greetings! I'm trying to make my ASPX page able to process WORD format document. I learned that RichTextBox might help me, but I can't use it either by adding it to my Web Control list or by writing "<asp:RichTextBox id="c1" />" in the ASPX file. The error message shows "Cannot find RichTextBox in the namespace of web controls" (something like that). Is there any way to add RichTextBox in ASPX file? Or where can I find a substitute?...
1
1685
by: tulasi | last post by:
I am placing textbox controls and combo box controls on richtext box and 2 command buttons on form control. after executing the application i'll place some text into textbox controls and select a value from combo box after entering of all the details i'll click on one of the command buttons then it will save the contents of the controls which i placed on the richtextbox into a file then i'll click on another command button so it will...
2
2891
by: AWesner | last post by:
I am currently working to create a VB program that will do more detailed in-file text search functions than windows has to offer. I have a form with a RichTextBox control to display the text that has been found in the files. The problem is that when a search has been found that is at the very start of the file and the .select method is used to select just the first portion it ends up selecting everything in the RichTextBox control...
9
4879
by: James Wong | last post by:
Hi, I use the RichTextBox in my program. It will use different language in this RichTextBox (chinese and english characters), and it set the "DualFont" and use different fonts. By the way, how can I print out this content to printer easily? Thanks! James
3
7192
by: michael sorens | last post by:
The documentation for the RichTextBox is sketchy at best. I want to do a very simple task but I cannot find information on this. I am using a RichTextBox as an output window. Some text I want to just add plain (e.g.. rtf.Text += "new stuff..."; ) but some text, when added, I want to be in a different color or font size. Find() will not work because the text will vary. I have delimiters on it so I could recognize it with a regular ...
4
13486
by: =?Utf-8?B?UmF5IE1pdGNoZWxs?= | last post by:
Hello, I have a multiline RichTextBox that I use for data logging. I'm concerned about how the AppendText method reacts when over time the maximum number of characters have been added. Do the oldest characters it contains start rolling off the top into the bit bucket, does it simply start silently ignoring appends until some characters, are deleted, or does some kind of exception get thrown? I've heard numerous opinions on what the...
0
9512
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10419
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10201
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10147
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9987
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7531
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5424
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4100
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 we have to send another system
3
2910
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.