Click here to Skip to main content
15,887,683 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: ListView exception - stumped! Pin
Dave Sexton20-Jul-06 23:54
Dave Sexton20-Jul-06 23:54 
GeneralRe: ListView exception - stumped! [modified] Pin
nzmike20-Jul-06 23:59
nzmike20-Jul-06 23:59 
GeneralRe: ListView exception - stumped! Pin
Dave Sexton21-Jul-06 0:52
Dave Sexton21-Jul-06 0:52 
AnswerRe: ListView exception - stumped! Pin
mr_lasseter21-Jul-06 11:02
mr_lasseter21-Jul-06 11:02 
GeneralRe: ListView exception - stumped! Pin
nzmike21-Jul-06 15:40
nzmike21-Jul-06 15:40 
QuestionCD scanning Pin
jinal_pandya20-Jul-06 23:18
jinal_pandya20-Jul-06 23:18 
AnswerRe: CD scanning Pin
Dave Sexton20-Jul-06 23:44
Dave Sexton20-Jul-06 23:44 
QuestionHow do I send RTF formated mail using VB.NET? Pin
govind yadav20-Jul-06 23:06
govind yadav20-Jul-06 23:06 
I am currently using a VB.NET program to send out e-mails with
plain text bodies (plus one attachment). The emails are being
received as Rich Text messages (probably just my personal Outlook
default, because I didn't do this in the program), but there is no
actual formatting (italics, color, etc.) in the message body, which
is passed to from VB.NET to Outlook as an unformatted text String.

I want to start applying formatting to the message body. In
particular, my app has a RichTextBox, which has an Rtf property,
which returns a String formatted as RTF, which contains whatever
my users type or paste into the RichTextBox. That is what I want
to send as the body of the message.


Unfortunately all I get is garbage, like this:


{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\froman\fprq2\fcharse­t0
Times New Roman;}{\f1\fnil\fcharset0 Microsoft Sans Serif;}}
{\colortbl ;\red255\green0\blue0;}
\viewkind4\uc1\pard\f0\fs24 This is \cf1 rich\cf0 \b\i text.\par
\b0\i0\par
\pard\f1\fs17\par



}


This is of course precisely the content of the input String,
formatting and all. Clearly I have failed to clue Outlook in that
the message body should be interpreted as RTF, not plain text. So
how should I do this?

Here is my code:


=== Begin Example ===
Imports Outlook = Microsoft.Office.Interop.Outlook


...


Sub MailerRoutine(ByVal Subject As String, ByVal Recipient As String, _
ByVal Body As String, ByVal Filename As String, ByVal displayName As String)


Dim oApp As Outlook.Application = CreateObject("Outlook.Application")


Dim oItem As Outlook.MailItem = oApp.CreateItem(Outlook.OlItemType.olMailItem)


oItem.Subject = Subject
oItem.To = Recipient
oItem.Body = Body
oItem.BodyFormat = Outlook.OlBodyFormat.olFormatRichText


Dim bodyLength As String = oItem.Body.Length


Dim oAttachments As Outlook.Attachments = oItem.Attachments
Dim oAttachment As Outlook.Attachment
oAttachment = oAttachments.Add(Filename, , bodyLength + 1, displayName)


oItem.Send()


oItem = Nothing
oApp = Nothing
End Sub
=== End Example ===




For Oriensoft Technologies Pvt. Ltd.

Govind Yadav

Software Developer
E-mail: govindy@oriensoft.com
Tel: +91-22-67111555 Fax: +91-22-67111666
24 x 7 Support & Sales Toll Free : 1-800-22-5171 (India Only)
Web : http://www.oriensoft.com




QuestionSQL compare date problem on VB Pin
campbells20-Jul-06 22:19
campbells20-Jul-06 22:19 
AnswerRe: SQL compare date problem on VB Pin
Paddy Boyd20-Jul-06 23:11
Paddy Boyd20-Jul-06 23:11 
GeneralRe: SQL compare date problem on VB Pin
campbells20-Jul-06 23:13
campbells20-Jul-06 23:13 
GeneralRe: SQL compare date problem on VB Pin
ChandraRam25-Jul-06 19:14
ChandraRam25-Jul-06 19:14 
GeneralRe: SQL compare date problem on VB Pin
ChandraRam25-Jul-06 19:15
ChandraRam25-Jul-06 19:15 
QuestionProblem with display of unicode characters with Crystal report Pin
Sithy20-Jul-06 22:00
Sithy20-Jul-06 22:00 
QuestionQuestion about notification among controls Pin
jgyie220-Jul-06 22:00
jgyie220-Jul-06 22:00 
AnswerRe: Question about notification among controls Pin
Rizwan Bashir21-Jul-06 5:30
Rizwan Bashir21-Jul-06 5:30 
GeneralRe: Thanks. Does Observer design pattern or others support that? Pin
jgyie221-Jul-06 6:29
jgyie221-Jul-06 6:29 
Questionanyone...thanks Pin
@$+r020-Jul-06 21:33
@$+r020-Jul-06 21:33 
AnswerRe: anyone...thanks Pin
Robert Rohde21-Jul-06 0:00
Robert Rohde21-Jul-06 0:00 
Questioncustom controls Pin
Dobromir Dimitrov20-Jul-06 20:59
Dobromir Dimitrov20-Jul-06 20:59 
AnswerRe: custom controls Pin
Dave Sexton20-Jul-06 21:30
Dave Sexton20-Jul-06 21:30 
GeneralRe: custom controls Pin
Dobromir Dimitrov20-Jul-06 21:35
Dobromir Dimitrov20-Jul-06 21:35 
QuestionHow to create buttons in Direct3D [MDX] Pin
Hoover8520-Jul-06 20:47
Hoover8520-Jul-06 20:47 
QuestionExtraction of attached files in PDF Pin
SuBaj20-Jul-06 17:22
SuBaj20-Jul-06 17:22 
AnswerRe: combo change not working? Pin
Rizwan Bashir20-Jul-06 22:55
Rizwan Bashir20-Jul-06 22:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.