从我的VB 2005快递表格。想发送电子邮件 [英] From my VB 2005 express Form. Want to send EMail

查看:510
本文介绍了从我的VB 2005快递表格。想发送电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经为电子邮件制作了表格。我输入了代码,但导入系统确实没有工作。它下面有一条曲折的线条,显示它没有通信。

它不会建立。


公共类Form3Bio1

系统。 Net.Mail.SmtpClient

导入System.Net.Mail''这行之前''不起作用。

我有剩下的代码可以尝试,如果我当我能够让系统正常工作。


''我XXX在下面的某些内容中仅仅针对本出版物。


Dim emailSender As SmtpClient

Dim theMessage As MailMessage

Dim SHost As String =(" smtp.XXXXX.com")

Dim Passwd As String =(" Harold45" ;)

Dim Recv As String =(" In **** @ XXXXXX.Com")

Dim Sndr As String =(" Ha **** @ XX.Com")

Dim Body As String =(Form4Bio1.TextBox5.Text)+

(Form4Bio1.ListBox1.Items)

emailSender = New System.Net.Mail.SmtpClient(_

SHost)


theMessage = New MailMessage

theMe ssage.From =新邮件地址(Sndr)

theMessage.To.Add(Recv)

theMessage.Subject =(Form4Bio1.TextBox4.Text)

theMessage.password =(Passwd)

theMessage.Body =(Form4Bio1.TextBox5.Text)+

(Form4Bio1.ListBox1.Items)


我试过导入System.Net.Mail但是找不到它。我安装了.Net

2.0。

我的表单系统不允许系统也不识别System.Net

感谢您的帮助提前。我不知道如何获取我的代码

识别Imports.System.Net.Mail。

-

Yonce教授,已退休商业飞行员。还退休大学部门

导演和教授。现在是一名沟通顾问和开发人员。

这篇文章对你有帮助吗?

-

退休的商业飞行员Yonce教授。还退休大学部门

导演和教授。目前是一名通信顾问和开发人员。

I have made form for E-Mail. I have entered code but the Import system does
not work. It has squiggly line underneath it showing it is not communicating.
It Will not build.

Public Class Form3Bio1
System.Net.Mail.SmtpClient
Imports System.Net.Mail '' This line before '' does not work.
I have the rest of code to try if and when I am able to get System working.

'' I XXX out certain entrys below just for this publication.

Dim emailSender As SmtpClient
Dim theMessage As MailMessage
Dim SHost As String = ("smtp.XXXXX.com")
Dim Passwd As String = ("Harold45")
Dim Recv As String = ("In****@XXXXXX.Com")
Dim Sndr As String = ("Ha****@XX.Com")
Dim Body As String = (Form4Bio1.TextBox5.Text) +
(Form4Bio1.ListBox1.Items)
emailSender = New System.Net.Mail.SmtpClient( _
SHost)

theMessage = New MailMessage
theMessage.From = New MailAddress(Sndr)
theMessage.To.Add(Recv)
theMessage.Subject = (Form4Bio1.TextBox4.Text)
theMessage.password = (Passwd)
theMessage.Body = (Form4Bio1.TextBox5.Text) +
(Form4Bio1.ListBox1.Items)

I have tried Importing the System.Net.Mail but can''t find it. I have .Net
2.0 installed.
My form system just does not allow System nor recognize the System.Net
Thanks for your kind help in advance. I do not know how I can get my code to
recognize Imports.System.Net.Mail.
--
Professor Yonce, Retired commercial pilot. Also retired college department
Director and Professor. Presently a Communications Consultant and Developer.
Was this post helpful to you?
--
Professor Yonce, Retired commercial pilot. Also retired college department
Director and Professor. Presently a Communications Consultant and Developer.

推荐答案

导入必须高于公共类声明。

这有帮助?

Robin S.

---------------------

Yonce教授 < Pr ************ @ discussion.microsoft.com写在

消息新闻:AF **************** ****************** @ microsof t.com ...
The imports have to be above the Public Class statement.
Does that help?

Robin S.
---------------------
"Professor Yonce" <Pr************@discussions.microsoft.comwrote in
message news:AF**********************************@microsof t.com...

>我为E做了表格-邮件。我输入了代码,但导入系统确实没有工作。它下方有一条曲折的线条,显示它不是通过b $ b进行沟通。

它不会构建。


Public Class Form3Bio1

System.Net.Mail.SmtpClient

Imports System.Net.Mail''这行之前''不起作用。

剩余部分代码尝试,如果我什么时候能够得到系统

工作。


''我XXX在下面的某些内容中仅仅是为了这个出版物。


Dim emailSender As SmtpClient

将theMessage调暗为MailMessage

Dim SHost As String =(" smtp.XXXXX.com")

Dim Passwd As String =(" Harold45")

Dim Recv As String =(" In **** @ XXXXXX.Com")

Dim Sndr As String =(" Ha **** @ XX.Com")

Dim Body As String =(Form4Bio1.TextBox5.Text)+

(Form4Bio1.ListBox1.Items)

emailSender =新的System.Net.Mail.SmtpClient(_

SHost)


theMessage =新MailMessage

theMessage.From =新邮件地址(Sndr)

theMessage.To.Add(Recv)

theMessage.Subject =(Form4Bio1.TextBox4.Text)

theMessage.password =(Passwd)

theMessage.Body =(Form4Bio1.TextBox5.Text)+

(Form4Bio1.ListBox1.Items)


我试过导入System.Net.Mail但是找不到它。我安装了.Net

2.0。

我的表单系统不允许系统也不识别System.Net

感谢您的帮助提前。我不知道如何获取我的代码



识别Imports.System.Net.Mail。

-

Yonce教授,退休的商业飞行员。还退休大学部门

导演和教授。现在是一名沟通顾问和

开发人员。

这篇文章对你有用吗?


-

退休的商业飞行员Yonce教授。还退休大学部门

导演和教授。目前是一名沟通顾问和

开发人员。
>I have made form for E-Mail. I have entered code but the Import system does
not work. It has squiggly line underneath it showing it is not
communicating.
It Will not build.

Public Class Form3Bio1
System.Net.Mail.SmtpClient
Imports System.Net.Mail '' This line before '' does not work.
I have the rest of code to try if and when I am able to get System
working.

'' I XXX out certain entrys below just for this publication.

Dim emailSender As SmtpClient
Dim theMessage As MailMessage
Dim SHost As String = ("smtp.XXXXX.com")
Dim Passwd As String = ("Harold45")
Dim Recv As String = ("In****@XXXXXX.Com")
Dim Sndr As String = ("Ha****@XX.Com")
Dim Body As String = (Form4Bio1.TextBox5.Text) +
(Form4Bio1.ListBox1.Items)
emailSender = New System.Net.Mail.SmtpClient( _
SHost)

theMessage = New MailMessage
theMessage.From = New MailAddress(Sndr)
theMessage.To.Add(Recv)
theMessage.Subject = (Form4Bio1.TextBox4.Text)
theMessage.password = (Passwd)
theMessage.Body = (Form4Bio1.TextBox5.Text) +
(Form4Bio1.ListBox1.Items)

I have tried Importing the System.Net.Mail but can''t find it. I have .Net
2.0 installed.
My form system just does not allow System nor recognize the System.Net
Thanks for your kind help in advance. I do not know how I can get my code
to
recognize Imports.System.Net.Mail.
--
Professor Yonce, Retired commercial pilot. Also retired college department
Director and Professor. Presently a Communications Consultant and
Developer.
Was this post helpful to you?
--
Professor Yonce, Retired commercial pilot. Also retired college department
Director and Professor. Presently a Communications Consultant and
Developer.



是RobinS ..它有效。谢谢,谢谢。

我把Imports一行放在Public Class语句之上,就像你说的那样。

我按计划发了三封电子邮件,这是第一封那次我看到那个节目

按照我的计划工作。哇!我以前从来不知道。它建立良好。没有错误。

我刚看到一个小问题我试图发送

TextBox.Text的内容。

它还没关系但是我还想再添加一个ListBox.Items来发送。

两者之间的+不起作用。如何添加TextBox.Text加上

ListBox.Items进入电子邮件?谢谢。

-

退休的商业飞行员Yonce教授。还退休大学部门

导演和教授。现在是一名沟通顾问和开发人员。

RobinS写道:
Yes RobinS.. It worked. Thank You, Thank You.
I put the Imports line above the Public Class statement just like you said.
I sent three e-mails as planned and Its the very first time I saw that program
work as I planned. Wow! I never knew that before. It Build fine. No errors.
I just saw one little problem I am trying to send the contents of the
TextBox.Text.
It went okay but I also wanted to add one more ListBox.Items to send also.
The + between the two did not work. How can I add the TextBox.Text plus the
ListBox.Items to go in the e-mail? Thanks.
--
Professor Yonce, Retired commercial pilot. Also retired college department
Director and Professor. Presently a Communications Consultant and Developer.
"RobinS" wrote:

导入必须高于公共类声明。

这有帮助吗?


Robin S.

---------------------

" Yonce教授" < Pr ************ @ discussion.microsoft.com写在

消息新闻:AF **************** ****************** @ microsof t.com ...
The imports have to be above the Public Class statement.
Does that help?

Robin S.
---------------------
"Professor Yonce" <Pr************@discussions.microsoft.comwrote in
message news:AF**********************************@microsof t.com...

我已为电子邮件制作表格。我输入了代码,但导入系统确实没有工作。它下方有一条曲折的线条,显示它不是通过b $ b进行沟通。

它不会构建。


Public Class Form3Bio1

System.Net.Mail.SmtpClient

Imports System.Net.Mail''这行之前''不起作用。

剩余部分代码尝试,如果我什么时候能够得到系统

工作。


''我XXX在下面的某些内容中仅仅是为了这个出版物。


Dim emailSender As SmtpClient

将theMessage调暗为MailMessage

Dim SHost As String =(" smtp.XXXXX.com")

Dim Passwd As String =(" Harold45")

Dim Recv As String =(" In **** @ XXXXXX.Com")

Dim Sndr As String =(" Ha **** @ XX.Com")

Dim Body As String =(Form4Bio1.TextBox5.Text)+

(Form4Bio1.ListBox1.Items)

emailSender =新的System.Net .Mail.SmtpClient(_

SHost)


theMessage = New MailMessage

theMessage.From = New MailAddress(Sndr)

theMessage.To.Add(Recv)

theMessage.Subject =(Form4Bio1.TextBox4.Text)

theMessage.password =(Passwd)

theMessage.Body =(Form4Bio1.TextBox5.Text)+

(Form4Bio1.ListBox1.Items)


我试过导入System.Net.Mail但找不到它。我安装了.Net

2.0。

我的表单系统不允许系统也不识别System.Net

感谢您的帮助提前。我不知道如何获取我的代码



识别Imports.System.Net.Mail。

-

Yonce教授,退休的商业飞行员。还退休大学部门

导演和教授。现在是一名沟通顾问和

开发人员。

这篇文章对你有用吗?

-

Yonce教授,退休的商业飞行员。还退休大学部门

导演和教授。目前是一名沟通顾问和

开发人员。
I have made form for E-Mail. I have entered code but the Import system does
not work. It has squiggly line underneath it showing it is not
communicating.
It Will not build.

Public Class Form3Bio1
System.Net.Mail.SmtpClient
Imports System.Net.Mail '' This line before '' does not work.
I have the rest of code to try if and when I am able to get System
working.

'' I XXX out certain entrys below just for this publication.

Dim emailSender As SmtpClient
Dim theMessage As MailMessage
Dim SHost As String = ("smtp.XXXXX.com")
Dim Passwd As String = ("Harold45")
Dim Recv As String = ("In****@XXXXXX.Com")
Dim Sndr As String = ("Ha****@XX.Com")
Dim Body As String = (Form4Bio1.TextBox5.Text) +
(Form4Bio1.ListBox1.Items)
emailSender = New System.Net.Mail.SmtpClient( _
SHost)

theMessage = New MailMessage
theMessage.From = New MailAddress(Sndr)
theMessage.To.Add(Recv)
theMessage.Subject = (Form4Bio1.TextBox4.Text)
theMessage.password = (Passwd)
theMessage.Body = (Form4Bio1.TextBox5.Text) +
(Form4Bio1.ListBox1.Items)

I have tried Importing the System.Net.Mail but can''t find it. I have .Net
2.0 installed.
My form system just does not allow System nor recognize the System.Net
Thanks for your kind help in advance. I do not know how I can get my code
to
recognize Imports.System.Net.Mail.
--
Professor Yonce, Retired commercial pilot. Also retired college department
Director and Professor. Presently a Communications Consultant and
Developer.
Was this post helpful to you?
--
Professor Yonce, Retired commercial pilot. Also retired college department
Director and Professor. Presently a Communications Consultant and
Developer.






您必须使用项目列表中的选定项目。你试图将
连接一个Listbox.ObjectCollection到一个字符串。


(虽然+工作,但在VB中,大多数人使用&所以那里'没有

怀疑它在做什么。)


我认为你应该检查并确保他们选择了物品
使用SelectedItem之前
。我会尝试以下,这应该是

是否可以选择1项或多项。


我会使用stringbuilder来构建字符串,效率。


Dim sb as StringBuilder

sb.Append Form4Bio1.TextBox5.Text

如果Form4Bio1.Listbox1.ItemsSelected。计数0然后

每个ListItem作为Form4Bio1.ListBox1.SelectedItems中的对象

sb.Append","

sb.Append ListItem .ToString

下一页

结束如果

theMessage.Body = sb.ToString

sb = Nothing


如果你愿意的话,你可以在

之间追加回车换行。只需替换,,与ControlChars.CrLf。


Robin S.

---------------------- --------------------

Yonce教授 < Pr ************ @ discussion.microsoft.com写在

消息新闻:FA **************** ****************** @ microsof t.com ...
You have to use the selected item(s) in the item list. You''re trying to
concatenate a Listbox.ObjectCollection to a string.

(And although + works, in VB most people use & so there''s no
doubt about what it''s doing.)

I think you should check and make sure they have selected items
before using the SelectedItem. I would try the following, which should
work whether they can select 1 item or many.

I''d use a stringbuilder to build the string, for efficiency.

Dim sb as StringBuilder
sb.Append Form4Bio1.TextBox5.Text
If Form4Bio1.Listbox1.ItemsSelected.Count 0 Then
For Each ListItem as Object in Form4Bio1.ListBox1.SelectedItems
sb.Append ", "
sb.Append ListItem.ToString
Next
End If
theMessage.Body = sb.ToString
sb = Nothing

You could append a carriage-return linefeed between
the items if you wanted to. Just replace the "," with ControlChars.CrLf.

Robin S.
------------------------------------------
"Professor Yonce" <Pr************@discussions.microsoft.comwrote in
message news:FA**********************************@microsof t.com...

是RobinS ..它有效。谢谢,谢谢。

我把Imports行放在Public Class语句之上就像你一样

说。

我发了三个e-邮件按计划进行,这是我第一次看到

计划

按照我的计划工作。哇!我以前从来不知道。它建立良好。没有

错误。

我刚看到一个小问题我试图发送

TextBox.Text的内容。

它还没关系,但我还想添加一个ListBox.Items来发送。

两者之间的+不起作用。如何在电子邮件中添加TextBox.Text和



ListBox.Items?谢谢。

-

退休的商业飞行员Yonce教授。还退休大学部门

导演和教授。现在是一名沟通顾问和

开发人员。


RobinS写道:
Yes RobinS.. It worked. Thank You, Thank You.
I put the Imports line above the Public Class statement just like you
said.
I sent three e-mails as planned and Its the very first time I saw that
program
work as I planned. Wow! I never knew that before. It Build fine. No
errors.
I just saw one little problem I am trying to send the contents of the
TextBox.Text.
It went okay but I also wanted to add one more ListBox.Items to send also.
The + between the two did not work. How can I add the TextBox.Text plus
the
ListBox.Items to go in the e-mail? Thanks.
--
Professor Yonce, Retired commercial pilot. Also retired college department
Director and Professor. Presently a Communications Consultant and
Developer.
"RobinS" wrote:

>导入必须高于公共类声明。
这有帮助吗?

Robin S.
---------------------
Yonce教授 < Pr ************ @ discussion.microsoft.com写在
消息新闻:AF ******************** ************** @ microsof t.com ...
>The imports have to be above the Public Class statement.
Does that help?

Robin S.
---------------------
"Professor Yonce" <Pr************@discussions.microsoft.comwrote in
message news:AF**********************************@microsof t.com...

>我已经为电子邮件制作了表格。我输入了代码,但导入系统

无效。它下方有一条曲折的线条,显示它不是通过b $ b进行沟通。

它不会构建。


Public Class Form3Bio1

System.Net.Mail.SmtpClient

Imports System.Net.Mail''这行之前''不起作用。

剩余部分代码尝试,如果我什么时候能够得到系统

工作。


''我XXX在下面的某些内容中仅仅是为了这个出版物。


Dim emailSender As SmtpClient

将theMessage调暗为MailMessage

Dim SHost As String =(" smtp.XXXXX.com")

Dim Passwd As String =(" Harold45")

Dim Recv As String =(" In **** @ XXXXXX.Com")

Dim Sndr As String =(" Ha **** @ XX.Com")

Dim Body As String =(Form4Bio1.TextBox5.Text)+

(Form4Bio1.ListBox1.Items)

emailSender =新的System.Net.Mail.SmtpClient(_

SHost)


theMessage =新MailMessage

theMessage.From =新邮件地址(Sndr)

theMessage.To.Add(Recv)

theMessage.Subject =(Form4Bio1.TextBox4.Text)

theMessage.password =(Passwd)

theMessage.Body =(Form4Bio1.TextBox5.Text)+

(Form4Bio1.ListBox1.Items)


我试过导入System.Net.Mail但是找不到它。我有

.Net

2.0安装。

我的表单系统不允许系统也不识别System.Net

感谢您的帮助。我不知道如何获得我的

代码



识别Imports.System.Net.Mail。

-

退休的商业飞行员Yonce教授。还退休的大学

部门

主任和教授。现在是一名沟通顾问和

开发人员。

这篇文章对你有用吗?


-

退休的商业飞行员Yonce教授。还退休的大学

部门

主任和教授。目前是一名沟通顾问和

开发人员。
>I have made form for E-Mail. I have entered code but the Import system
does
not work. It has squiggly line underneath it showing it is not
communicating.
It Will not build.

Public Class Form3Bio1
System.Net.Mail.SmtpClient
Imports System.Net.Mail '' This line before '' does not work.
I have the rest of code to try if and when I am able to get System
working.

'' I XXX out certain entrys below just for this publication.

Dim emailSender As SmtpClient
Dim theMessage As MailMessage
Dim SHost As String = ("smtp.XXXXX.com")
Dim Passwd As String = ("Harold45")
Dim Recv As String = ("In****@XXXXXX.Com")
Dim Sndr As String = ("Ha****@XX.Com")
Dim Body As String = (Form4Bio1.TextBox5.Text) +
(Form4Bio1.ListBox1.Items)
emailSender = New System.Net.Mail.SmtpClient( _
SHost)

theMessage = New MailMessage
theMessage.From = New MailAddress(Sndr)
theMessage.To.Add(Recv)
theMessage.Subject = (Form4Bio1.TextBox4.Text)
theMessage.password = (Passwd)
theMessage.Body = (Form4Bio1.TextBox5.Text) +
(Form4Bio1.ListBox1.Items)

I have tried Importing the System.Net.Mail but can''t find it. I have
.Net
2.0 installed.
My form system just does not allow System nor recognize the System.Net
Thanks for your kind help in advance. I do not know how I can get my
code
to
recognize Imports.System.Net.Mail.
--
Professor Yonce, Retired commercial pilot. Also retired college
department
Director and Professor. Presently a Communications Consultant and
Developer.
Was this post helpful to you?
--
Professor Yonce, Retired commercial pilot. Also retired college
department
Director and Professor. Presently a Communications Consultant and
Developer.







这篇关于从我的VB 2005快递表格。想发送电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆