473,654 Members | 3,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Te xt & 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.W ebControls
Imports System.Data
Imports System.Data.Ole Db
Imports System.Web.Mail
Public Class sendForm : Inherits System.Web.UI.P age

Protected WithEvents txtFirstName As System.Web.UI.W ebControls.Text Box
Protected WithEvents txtLastName As System.Web.UI.W ebControls.Text Box
Protected WithEvents txtCompany As System.Web.UI.W ebControls.Text Box
Protected WithEvents txtTitle As System.Web.UI.W ebControls.Text Box
Protected WithEvents txtPhone As System.Web.UI.W ebControls.Text Box
Protected WithEvents txtEmail As System.Web.UI.W ebControls.Text Box
Protected WithEvents txtReferrer As System.Web.UI.W ebControls.Text Box
Protected WithEvents btnSubmit As System.Web.UI.W ebControls.Butt on

'Public Const microsoft.visua lbasic.Constant s.vbCrLf as String =
Microsoft.Visua lBasic.ControlC hars.vbCrLf

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

Dim objMM as New MailMessage()
objMM.To = "xy*@someaddres s.com"
objMM.From = "so*****@somead dress.com"
objMM.BodyForma t = MailFormat.Html
objMM.Priority = MailPriority.No rmal
objMM.Subject = "Form details"

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

SmtpMail.SmtpSe rver = ""
SmtpMail.Send(o bjMM)
End Sub

End Class

Nov 18 '05 #1
0 1647

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

Similar topics

6
2233
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 mail box. Here is the code! The form has just three values!
10
3132
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 the 'creditcard' fields return
4
1443
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 Month/Year format? How do I do that? I can't seem to be able to find this either through the help file or with playing around with the properties. I know it's a silly one but we all have to start from as low as this lol :) thanks in advance
1
1133
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
2560
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# newsgroup on 25 September. The regular expressions where in that newsgroup too involved. I told yesterday night, to Jay that I would test all 4 methods and the stupid method I was thinking of the first time that night when I saw Jon's
11
1677
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 will type a message, and a button. Once he presses this button the application will send an email to me (my email address will be hardcoded). I don't think that it can get any simpler. Problem is that how to send email from standalone machine...
0
1427
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. This text is inserted into a text field in an SQL server. When the data is read and presented by the datalist, the line breaks are gone. All the text is just together without paragraphing. I am able to keep the spaces if I try this approach:
6
2519
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 Frontpage and the orderform calls a rather simple asp-script, which basically just defines a few parameters and inserts these into an email, which is sent to the booking department. The orderform lists the different types of rooms that can be...
5
1474
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 the form and included a couple free type multine textboxes. When the user presses submit an message is created with the responses and fired off to a MS Exchange mail enabled public folder.
0
8379
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8709
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...
0
8596
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...
0
7309
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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
5627
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
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...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1597
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.