473,386 Members | 1,745 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.

Simple question about 'vbCrLf' is not declared

Joe
Hi,

I have a simple form that does nothing but emails the whatever user entered
in the form fields. The form is working fine and email sent. The problem I
am having is in te string that forms the body of the email. I just want to
insert line breaks using vbCrLf, but when I do that I get an error saying,

Compiler Error Message: BC30451: Name 'vbCrLf' is not declared.
The lins that gets highlighted is

objMM.Body = "First Name: " & txtFirstName.Text & vbCrLf & vbCrLf & "Last
Name: " & _

To see what I am doing, I have pasted to the code from the code behind file.
As you can see I am using VB and C#. I would appreciate if you can give me
some idea as why vbCrLf is not working.

Thanks in advance

Joe

Option Explicit On
Option Strict On

Imports System
Imports System.IO
Imports System.Web.UI.WebControls
Imports System.Data
Imports System.Data.OleDb
Imports System.Web.Mail
Public Class sendForm : Inherits System.Web.UI.Page

Protected WithEvents txtFirstName As System.Web.UI.WebControls.TextBox
Protected WithEvents txtLastName As System.Web.UI.WebControls.TextBox
Protected WithEvents txtCompany As System.Web.UI.WebControls.TextBox
Protected WithEvents txtTitle As System.Web.UI.WebControls.TextBox
Protected WithEvents txtPhone As System.Web.UI.WebControls.TextBox
Protected WithEvents txtEmail As System.Web.UI.WebControls.TextBox
Protected WithEvents txtReferrer As System.Web.UI.WebControls.TextBox
Protected WithEvents btnSubmit As System.Web.UI.WebControls.Button

'Public Const microsoft.visualbasic.Constants.vbCrLf as String =
Microsoft.VisualBasic.ControlChars.vbCrLf

Sub Submit(ByVal sender As System.Object, ByVal e As System.EventArgs)

Dim objMM as New MailMessage()
objMM.To = "xy*@someaddress.com"
objMM.From = "so*****@someaddress.com"
objMM.BodyFormat = MailFormat.Html
objMM.Priority = MailPriority.Normal
objMM.Subject = "Form details"

'Set the body
objMM.Body = "First Name: " & txtFirstName.Text & vbCrLf & vbCrLf &
"Last Name: " & _
txtLastName.Text & vbCrLf & vbCrLf & "Company: " &
txtCompany.Text & vbCrLf & vbCrLf & _
"Title: " & txtTitle.Text & vbCrLf & vbCrLf & "Phone: " &
txtPhone.Text & vbCrLf & vbCrLf & _
"Email: " & txtEmail.Text & vbCrLf & vbCrLf & "Referrer: " &
txtReferrer.Text & vbCrLf & vbCrLf & _
"Timestamp: " & DateTime.Now() & vbCrLf & vbCrLf & "IP address: " &
Request.UserHostAddress()

SmtpMail.SmtpServer = ""
SmtpMail.Send(objMM)
End Sub

End Class

Nov 18 '05 #1
0 1632

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

Similar topics

6
by: Benny Alexander | last post by:
Hi, I am using a simple form 2 email program. I ama experienced programmer, But I feel very bad, as I am unable to fix this problem. All seems to be fine, But the mail is not reacing to my...
10
by: Harvey Waxman | last post by:
suddenly get this error: error '80040108' /geta.asp, line 23 which is : ObjMail.Body = "Instructions" & vbtab & instructions & vbcrlf&_ and while I'm at it, why did the 'yourname' and...
4
by: merlin | last post by:
greetings to all. i am new to the group and to access. I am using access 97 to setup our clinic's database and in one of the tables I need to be able to type in a date only in terms of the...
1
by: Daniel | last post by:
Before writing a code to send a mail using asp.net, what steps have to be taken Like do some configuration ? coz i'm new to .Net your help will be appreciated. Daniel.
35
by: Cor | last post by:
Hallo, I have promised Jay B yesterday to do some tests. The subject was a string evaluation that Jon had send in. Jay B was in doubt what was better because there was a discussion in the C#...
11
by: Sehboo | last post by:
Hi, I want to write a very very simple mail application which my father can use (maybe then I will be able to send and receive emails from him). This application will have a text box, where he...
0
by: Jim in Arizona | last post by:
Is there an easier way to make a datalist aware of line breaks within text fields? I have a text box that users can type into. If they press the enter key a few times, VB sees this as a vbCrLf....
6
by: kamazoo | last post by:
I have no programming experience whatsoever, but nevertheless am I currently responsible for an update of a website, where a few hotels can be booked using an orderform. The website is built with...
5
by: =?Utf-8?B?VG9ueSBXaXNzbGVy?= | last post by:
Hello everyone- I am hoping a couple of you will have some ideas on this one... I have a webform created in visual basic 2005. Basically, the webform gather answers to the questions asked on...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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?
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
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
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,...

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.