473,554 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"Declaratio n Expected" - Copy/Pasted DIRECTLY from the help files.

rdi
The import statements weren't copy/pasted, but everything INSIDE the class WAS copy pasted from the help file. Starting with the myMail.From line and going down to the SmtpMail.Send line, EVERY line results in a "Declaratio n Expected" error.

--

RDI

(remove the exclamation from the email address)

Imports System.Web
Imports System.Web.Mail
Imports System.Web.Mail .SmtpMail
Imports System.Web.Mail .MailAttachment
Imports System.Web.Mail .MailMessage
Imports System.Web.Mail .MailFormat
Public Class myEMail
Dim myMail As New MailMessage()
myMail.From = "fr**@microsoft .com"
myMail.To = "to@microsoft.c om"
myMail.Subject = "UtilMailMessag e001"
myMail.Priority = MailPriority.Lo w
myMail.BodyForm at = MailFormat.Html
myMail.Body = "<html><body>Ut ilMailMessage00 1 - success</body></html>"
SmtpMail.Send(m yMail)
End Class

Nov 20 '05 #1
3 2251
Did you add the System.Web.Dll reference. T

his works for me!

OHM

"rdi" <rd**@writeme.c om> wrote in message news:eB******** ********@TK2MSF TNGP12.phx.gbl. ..
The import statements weren't copy/pasted, but everything INSIDE the class WAS copy pasted from the help file. Starting with the myMail.From line and going down to the SmtpMail.Send line, EVERY line results in a "Declaratio n Expected" error.

--

RDI

(remove the exclamation from the email address)

Imports System.Web
Imports System.Web.Mail
Imports System.Web.Mail .SmtpMail
Imports System.Web.Mail .MailAttachment
Imports System.Web.Mail .MailMessage
Imports System.Web.Mail .MailFormat
Public Class myEMail
Dim myMail As New MailMessage()
myMail.From = "fr**@microsoft .com"
myMail.To = "to@microsoft.c om"
myMail.Subject = "UtilMailMessag e001"
myMail.Priority = MailPriority.Lo w
myMail.BodyForm at = MailFormat.Html
myMail.Body = "<html><body>Ut ilMailMessage00 1 - success</body></html>"
SmtpMail.Send(m yMail)
End Class

Nov 20 '05 #2
rdi
Yes that was already added.

But I found it. This was a STUPID mistake. That code was in the class--but not inside a sub or function. It dawned on me about 10 seconds AFTER I pressed SEND--just enough time for me to really feel like a fool. DUH! <grin>

--

RDI

(remove the exclamation from the email address)

"One Handed Man ( OHM#)" <news.microsoft .com> wrote in message news:eF******** ******@TK2MSFTN GP09.phx.gbl...
Did you add the System.Web.Dll reference. T

his works for me!

OHM

"rdi" <rd**@writeme.c om> wrote in message news:eB******** ********@TK2MSF TNGP12.phx.gbl. ..
The import statements weren't copy/pasted, but everything INSIDE the class WAS copy pasted from the help file. Starting with the myMail.From line and going down to the SmtpMail.Send line, EVERY line results in a "Declaratio n Expected" error.

--

RDI

(remove the exclamation from the email address)

Imports System.Web
Imports System.Web.Mail
Imports System.Web.Mail .SmtpMail
Imports System.Web.Mail .MailAttachment
Imports System.Web.Mail .MailMessage
Imports System.Web.Mail .MailFormat
Public Class myEMail
Dim myMail As New MailMessage()
myMail.From = "fr**@microsoft .com"
myMail.To = "to@microsoft.c om"
myMail.Subject = "UtilMailMessag e001"
myMail.Priority = MailPriority.Lo w
myMail.BodyForm at = MailFormat.Html
myMail.Body = "<html><body>Ut ilMailMessage00 1 - success</body></html>"
SmtpMail.Send(m yMail)
End Class

Nov 20 '05 #3
* "rdi" <rd**@writeme.c om> scripsit:
The import statements weren't copy/pasted, but everything INSIDE the class WAS copy pasted from the help file.* Starting with
the myMail.From line and going down to the SmtpMail.Send line, EVERY line results in a "Declaratio n Expected" error.


Instead of creating a new class, use something like this:

\\\
Dim myMail As New MailMessage()
MyMail.From = ...
....
///

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #4

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

Similar topics

13
141217
by: Squid Seven | last post by:
This is just bizarre. for the following snippet of code: #include <string> using std::string; I get the error message:
2
9786
by: Chuck Martin | last post by:
I am having a most frustrating problem that references, web searches, and other resources are no help so far in solving. Basically, I'm trying to design a pop-up window to be called with a funciton in a link. that function can have parameters for URL and window name passed to it. This works peachy in Firefox (1.0). With IE 6 (6.0.29) on two...
7
2552
by: Aaron G via AccessMonster.com | last post by:
Wanted to share a solution to something which I didn't find on the net: EVERY form in my Microsoft Access 2002 database gave an error any time any code was to be called: form OnOpen, button OnClick, etc. Error was: <b>The expression On Open you entered as the event property setting produced the following error: Expecteed: end of...
5
4950
by: TJS | last post by:
trying to display pdf file in browser fails on this line: Response.ContentType = "application/pdf" getting an error about no declaration found for "response" what declaration is needed ???
0
7605
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...
0
7530
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...
0
7808
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. ...
0
8047
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...
0
7893
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...
0
6156
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...
0
5162
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...
0
3570
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...
0
845
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...

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.