操作员'和'未定义 [英] OPERATOR '&' IS NOT DEFINED
问题描述
有人可以告诉我为什么我会收到以下代码的消息吗?
编译器错误消息:BC30452:没有为类型定义运算符''&'' >
''字符串''和''System.Web.UI.WebControls.TextBox''。
< html>
< head>
<%@Import Namespace =" System.Web.Mail" %>
< script language =" VB" runat =" server">
Sub btnSendFeedback_Click(发送者为对象,e为EventArgs)
''创建一个实例MailMessage类
Dim objMM as New MailMessage()
''设置属性 - 将电子邮件发送给填写
''反馈表。
objMM.To =" xx ***** @ xxxxxxx.com"
objMM.From =" xx ***** @ xxxxxxx.com"
''以html格式发送
objMM.BodyFormat = MailFormat.html
''设置优先级 - 选项为高,低和正常
objMM.Priority = MailPriority .Normal
''设置主题
objMM.Subject ="事故调查表
' '设置身体
objMM.Body = DateTime.Now +" HI &安培; _
"< html>" &安培; vbCrLf& vbCrLf& _
"< head>" &安培; vbCrLf& vbCrLf& _
"< / head>"& vbCrLf& vbCrLf& _
"< body>" &安培; vbCrLf& vbCrLf& _
发生事故的地点:
Location.Text& _
"< br>"& _
Check1.Text& "。" &安培; vbCrLf& vbCrLf& _
vbCrLf& vbCrLf& _
Check2.Text& vbCrLf& _
"< / td>" &安培; vbCrLf& vbCrLf& _
"< / body>" &安培; vbCrLf& vbCrLf& _
"< / html>"
''指定使用默认的Smtp服务器
SmtpMail.SmtpServer =""
''现在,要发送消息,请使用SmtpMail类的Send方法
SmtpMail.Send(objMM)
panelSendEmail.Visible = false
panelMailSent.Visible = true
结束子
< / script>
< / head>
< body>
< table width =" 750" BGCOLOR = QUOT;#E9EDF4" table border =" 1" cellpadding =" 3">
< h3>< center>< font face =" Verdana"> Wheeler'的事故调查
表格< / font>< / h3>
< hr>
<%--__________________________________________________ __________________________-- %>
<% - ROW 1 - %>
< td width =" 250" valign =" top">
< form runat =" server">
< font face =" Verdana" Size =" 2">
发生事故的位置:< asp:textbox id =" Location" runat = server
Width =" 200" />
< / td>
< ; td align =" right" VALIGN = QUOT;顶" width =" 225">
< font face =" Verdana"大小=" 2">雇主的房产
< asp:CheckBox id = Check1 Text =" yes" RUNAT = QUOT;服务器" />
< asp:CheckBox id = Check2 Text =" no" RUNAT = QUOT;服务器" />
< br>
工作网站
< asp:CheckBox id = Check3 Text = QUOT;是" RUNAT = QUOT;服务器" />
< asp:CheckBox id = Check4 Text =" no" RUNAT = QUOT;服务器" />
< / td>
< td>
< font face =" ;宋体"大小=" 2">事故发生日期< / font>< br>
< asp:textbox id ="日期" runat = server Width =" 100" />
< / td>
<%--__________________________________________________ __________________________--%>
<% - ROW 2 - %>
< tr< td>
< ; font face =" Verdana" Size =" 2">谁受伤?< / font>< br>
< asp:textbox id =" Who" runat = server width =" 200" />
< / td>
< td align =" left" >
< font face =" Verdana" Size =" 2"> Employee< asp:CheckBox id = Check5
runat =" server" />
< br>
非员工< asp:CheckBox id = Check6 runat =" server" />
< / td>
事故发生时间a.m.< asp:textbox id =" am" runat = server Width =" 90" />
p.m. < asp:textbox id =" pm" runat = server Width =" 90" />
< / TD>
<%--__________________________________________________ __________________________-- %>
<% - ROW 3 - %>
< tr>
>
< td>
< font face =" Verdana"大小=" 2">雇用日期< br< asp:textbox id =" Hiredate"
runat = server />
< / td>
< td>
< font face =" Verdana"大小=" 2">职称或职业< br>< asp:textbox
id ="职业" runat = server width =" 200" />
< / td>
< td>
< font face =" Verdana"大小=" 2">员工在工作中工作了多长时间?
伤害发生?< br>< asp:textbox id =" lengthofjob" runat = server />
< / td>
<%--__________________________________________________ __________________________--%>
<% - 第4行 - %>
& nbsp& nbsp
< p>
< asp:Label id = Label1 font-name =" arial"字体大小= QUOT; 10PT" runat =" server" />
<!复制自/ smirnof>
< asp:panel id =" panelSendEmail" runat =" server">
<% - asp:textbox id = runat =" server" / - %>
< br>
< b>您的留言:< / b>< br>
<% - asp:textbox id =" txtMessage" TextMode =" MultiLine"
Columns =" 40"行= QUOT; 10" RUNAT = QUOT;服务器" / - %>
< p>
< asp:button runat =" server" ID = QUOT; btnSendFeedback" Text ="发送
反馈!"
OnClick =" btnSendFeedback_Click" />
< / asp:panel>
< asp:panel id =" panelMailSent" RUNAT = QUOT;服务器" Visible =" False"
电子邮件已发送到您指定的电子邮件地址。
谢谢!
< / asp:panel>
< / form>
< / body>
< / html>
Can somebody tell me why I get this message with the following code?
Compiler Error Message: BC30452: Operator ''&'' is not defined for types
''String'' and ''System.Web.UI.WebControls.TextBox''.
<html>
<head>
<% @Import Namespace="System.Web.Mail" %>
<script language="VB" runat="server">
Sub btnSendFeedback_Click(sender as Object, e as EventArgs)
''Create an instance of the MailMessage class
Dim objMM as New MailMessage()
''Set the properties - send the email to the person who filled out the
''feedback form.
objMM.To = "xx*****@xxxxxxx.com"
objMM.From = "xx*****@xxxxxxx.com"
''send in html format
objMM.BodyFormat = MailFormat.html
''Set the priority - options are High, Low, and Normal
objMM.Priority = MailPriority.Normal
''Set the subject
objMM.Subject = "Accident Investigation Form"
''Set the body
objMM.Body = DateTime.Now + " HI " & _
"<html>" & vbCrLf & vbCrLf & _
"<head>" & vbCrLf & vbCrLf & _
"</head>"& vbCrLf & vbCrLf & _
"<body>" & vbCrLf & vbCrLf & _
Location where accident occurred:
Location.Text & _
"<br>"& _
Check1.Text & "." & vbCrLf & vbCrLf & _
vbCrLf &vbCrLf & _
Check2.Text & vbCrLf & _
"</td>" & vbCrLf & vbCrLf & _
"</body>" & vbCrLf & vbCrLf & _
"</html>"
''Specify to use the default Smtp Server
SmtpMail.SmtpServer = ""
''Now, to send the message, use the Send method of the SmtpMail class
SmtpMail.Send(objMM)
panelSendEmail.Visible = false
panelMailSent.Visible = true
End Sub
</script>
</head>
<body>
<table width="750" bgcolor="#E9EDF4" table border="1" cellpadding="3">
<h3><center><font face="Verdana">Wheeler''s Accident Investigation
Form</font></h3>
<hr>
<%--__________________________________________________ __________________________--%>
<%--ROW 1--%>
<td width="250" valign="top">
<form runat="server">
<font face="Verdana" Size="2">
Location where accident occurred: <asp:textbox id="Location" runat=server
Width="200"/>
</td>
<td align="right" valign="top" width="225">
<font face="Verdana" Size="2">Employer''s Premises
<asp:CheckBox id=Check1 Text="yes" runat="server" />
<asp:CheckBox id=Check2 Text="no" runat="server" />
<br>
Job site
<asp:CheckBox id=Check3 Text="yes" runat="server" />
<asp:CheckBox id=Check4 Text="no" runat="server" />
</td>
<td>
<font face="Verdana" Size="2">Date of accident</font><br>
<asp:textbox id="Date" runat=server Width="100"/>
</td>
<%--__________________________________________________ __________________________--%>
<%--ROW 2--%>
<tr<td>
<font face="Verdana" Size="2">Who was injured?</font><br>
<asp:textbox id="Who" runat=server width="200"/>
</td>
<td align= "left">
<font face="Verdana" Size="2">Employee <asp:CheckBox id=Check5
runat="server" />
<br>
Non-employee <asp:CheckBox id=Check6 runat="server" />
</td>
<td align="right"><font face="Verdana" Size="2">
Time of accident a.m. <asp:textbox id="am" runat=server Width="90"/>
p.m. <asp:textbox id="pm" runat=server Width="90"/>
</TD>
<%--__________________________________________________ __________________________--%>
<%--ROW 3--%>
<tr>
<td>
<font face="Verdana" Size="2">Date of Hire <br<asp:textbox id="Hiredate"
runat=server/>
</td>
<td>
<font face="Verdana" Size="2">Job Title or Occupation <br><asp:textbox
id="occupation" runat=server width="200"/>
</td>
<td>
<font face="Verdana" Size="2">How long has employee worked at job where
injury occurred?<br><asp:textbox id="lengthofjob" runat=server/>
</td>
<%--__________________________________________________ __________________________--%>
<%--Row 4--%>
  
<p>
<asp:Label id=Label1 font-name="arial" font-size="10pt" runat="server"/>
<!Copied from /smirnof>
<asp:panel id="panelSendEmail" runat="server">
<%--asp:textbox id= runat="server" /--%>
<br>
<b>Your Message:</b><br>
<%--asp:textbox id="txtMessage" TextMode="MultiLine"
Columns="40" Rows="10" runat="server" /--%>
<p>
<asp:button runat="server" id="btnSendFeedback" Text="Send
Feedback!"
OnClick="btnSendFeedback_Click" />
</asp:panel>
<asp:panel id="panelMailSent" runat="server" Visible="False">
An email has been sent to the email address you specified.
Thanks!
</asp:panel>
</form>
</body>
</html>
推荐答案
" dancer" < da **** @ microsoft.comwrote in message
news:uU ************* @ TK2MSFTNGP05.phx.gbl ...
"dancer" <da****@microsoft.comwrote in message
news:uU*************@TK2MSFTNGP05.phx.gbl...
有人可以告诉我为什么我用以下代码收到此消息?
编译器错误消息:BC30452:运算符''&' '没有为类型定义
''String''和''System.Web.UI.WebControls.TextBox''。
Can somebody tell me why I get this message with the following code?
Compiler Error Message: BC30452: Operator ''&'' is not defined for types
''String'' and ''System.Web.UI.WebControls.TextBox''.
通常这意味着你试图使用< asp:TextBox>
的内容而不指定其.Text属性
例如位置而不是Location.Text
然而,我想知道是否可能是因为你忘记了双b / b
这里的引用:
Normally that means you''re trying to use the contents of an <asp:TextBox>
without specifying its .Text property
e.g. Location instead of Location.Text
However, I''m wondering if it might be because you''ve forgotten the double
quotes here:
"< body>" &安培; vbCrLf& vbCrLf& _
发生事故的地点:
Location.Text& _
"<body>" & vbCrLf & vbCrLf & _
Location where accident occurred:
Location.Text & _
--
http://www.markrae.net
您不需要在HTML正文中设置html / head / body标签
....并且,在VbCrLf线程中,我们确定你不能在HTML中使用VbCrLf。
其他:你必须*将所有HTML内容放在一行。
你不能用代码打破界限。
摆脱所有的VbCrLf以及所有&并将所有HTML写在一行中,
使用< br>"< br />"来打破正文的内容。或< P ...< / P>根据需要。
另外,你不能在你的HTML中插入文本框控件。
所以,Check1.Text也出来了。
如果你想引用他们的内容,用户填写后,
将其捕获到变量并使用它,然后写入正文。
插入:
Dim Check1 as String = Check1.Text
Dim Check2 as String = Check2。文字
昏暗的位置为String = Location.Text
之前Dim objMM as New MailMessage()
和在编写正文时,请使用:
mail.Body =" Hi,< p>事故发生的地点是: &安培;位置& "<峰; br />" &安培; Check1& "。"
''等
你*可以*使用&引用文本变量。
注意引号的位置。
Juan T. Llibre,asp.net MVP
asp.net faq: http://asp.net.do/faq/
foros de asp.net,en espa?ol: http: //asp.net.do/foros/
============================ =======
" dancer" < da **** @ microsoft.com在消息新闻中写道:uU ************* @ TK2MSFTNGP05.phx.gbl ...
You don''t need to set the html/head/body tags within the HTML body
....and, in the VbCrLf thread, we established that you can''t use VbCrLf in HTML.
Something else : you *must* put all the HTML content in ONE line.
You can''t break the lines with code.
Get rid of all the "VbCrLf" and all the "&" and write all your HTML in a single line,
line-breaking the body''s content with "<br />" or "<P... </P>" as needed.
Also, you can''t insert Textbox controls into your HTML.
So, Check1.Text is out, too.
If you want to reference their content, after a user fills them out,
capture it to a variable and use that, before writing to the body.
insert :
Dim Check1 as String = Check1.Text
Dim Check2 as String = Check2.Text
Dim Location as String = Location.Text
before "Dim objMM as New MailMessage()"
and, when composing the body, use :
mail.Body="Hi, <p>The location where the accident occurred is :" & Location & "<br/>" & Check1 & "."
'' etc.
You *can* use the & to reference text variables.
Notice the location of the quote marks.
Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espa?ol : http://asp.net.do/foros/
===================================
"dancer" <da****@microsoft.comwrote in message news:uU*************@TK2MSFTNGP05.phx.gbl...
有人可以告诉我为什么我用以下代码收到此消息?
编译器错误消息:BC30452:运算符''&''未定义类型''字符串''和
''System.Web.UI.WebControls.TextBox''。
< html>
< head>
<%@Intort Namespace =" System.Web.Mail" %>
< script language =" VB" runat =" server">
Sub btnSendFeedback_Click(发送者为对象,e为EventArgs)
''创建一个实例MailMessage类
Dim objMM as New MailMessage()
''设置属性 - 将电子邮件发送给填写
''反馈表。
objMM.To =" xx ***** @ xxxxxxx.com"
objMM.From =" xx ***** @ xxxxxxx.com"
''以html格式发送
objMM.BodyFormat = MailFormat.html
''设置优先级 - 选项为高,低和正常
objMM .Priority = MailPriority.Normal
''设置主题
objMM.Subject ="事故调查表格
''设置身体
objMM.Body = DateTime.Now +" HI &安培; _
"< html>" &安培; vbCrLf& vbCrLf& _
"< head>" &安培; vbCrLf& vbCrLf& _
"< / head>"& vbCrLf& vbCrLf& _
"< body>" &安培; vbCrLf& vbCrLf& _
发生事故的地点:
Location.Text& _
"< br>"& _
Can somebody tell me why I get this message with the following code?
Compiler Error Message: BC30452: Operator ''&'' is not defined for types ''String'' and
''System.Web.UI.WebControls.TextBox''.
<html>
<head>
<% @Import Namespace="System.Web.Mail" %>
<script language="VB" runat="server">
Sub btnSendFeedback_Click(sender as Object, e as EventArgs)
''Create an instance of the MailMessage class
Dim objMM as New MailMessage()
''Set the properties - send the email to the person who filled out the
''feedback form.
objMM.To = "xx*****@xxxxxxx.com"
objMM.From = "xx*****@xxxxxxx.com"
''send in html format
objMM.BodyFormat = MailFormat.html
''Set the priority - options are High, Low, and Normal
objMM.Priority = MailPriority.Normal
''Set the subject
objMM.Subject = "Accident Investigation Form"
''Set the body
objMM.Body = DateTime.Now + " HI " & _
"<html>" & vbCrLf & vbCrLf & _
"<head>" & vbCrLf & vbCrLf & _
"</head>"& vbCrLf & vbCrLf & _
"<body>" & vbCrLf & vbCrLf & _
Location where accident occurred:
Location.Text & _
"<br>"& _
7Check1.Text& "。" &安培; vbCrLf& vbCrLf& _
7Check1.Text & "." & vbCrLf & vbCrLf & _
>
vbCrLf& vbCrLf& _
Check2.Text& vbCrLf& _
"< / td>" &安培; vbCrLf& vbCrLf& _
"< / body>" &安培; vbCrLf& vbCrLf& _
"< / html>"
''指定使用默认的Smtp服务器
>
SmtpMail.SmtpServer =""
''现在,要发送消息,请使用SmtpMail类的Send方法
SmtpMail.Send(objMM)
panelSendEmail.Visible = false
panelMailSent.Visible = true
结束子
< / script>
< / head>
< body>
< table width =" 750" BGCOLOR = QUOT;#E9EDF4" table border =" 1" cellpadding =" 3">
< h3>< center>< font face =" Verdana"> Wheeler'的事故调查表< / font> < / h3>
< hr>
<%--__________________________________________________ __________________________--%>
<% - ROW 1 - %>
< td width =" 250" valign =" top">
< form runat =" server">
< font face ="宋体" Size =" 2">
发生事故的位置:< asp:textbox id =" Location" runat = server Width =" 200" />
< / td>
< td align =" right" VALIGN = QUOT;顶" width =" 225">
< font face =" Verdana"大小=" 2">雇主的房产
< asp:CheckBox id = Check1 Text =" yes" RUNAT = QUOT;服务器" />
< asp:CheckBox id = Check2 Text =" no" RUNAT = QUOT;服务器" />
< br>
工作地点
< asp:CheckBox id = Check3 Text =" yes" RUNAT = QUOT;服务器" />
< asp:CheckBox id = Check4 Text =" no" RUNAT = QUOT;服务器" />
< / td>
< td>
< font face =" Verdana"大小=" 2">事故发生日期< / font>< br>
< asp:textbox id ="日期" runat = server Width =" 100" />
< / td>
<%--__________________________________________________ __________________________-- %>
<% - ROW 2 - %>
< tr< td>
< font face =" Verdana" Size =" 2">谁受伤?< / font>< br>
< asp:textbox id =" Who" runat = server width =" 200" />
< / td>
< td align =" left" >
< font face =" Verdana" Size =" 2"> Employee< asp:CheckBox id = Check5 runat =" server" />
< br>
非员工< asp:CheckBox id = Check6 runat =" server" />
< / td>
< td align =" right">< font face ="宋体"大小=" 2">
事故发生时间a.m.< asp:textbox id =" am" runat = server Width =" 90" />
p.m. < asp:textbox id =" pm" runat = server Width =" 90" />
< / TD>
<%--__________________________________________________ __________________________-- %>
<% - ROW 3 - %>
< tr>
>
< td>
< font face =" Verdana"大小=" 2">雇用日期< br< asp:textbox id =" Hiredate" runat = server />
< / td>
< td>
< font face =" Verdana" Size =" 2">职位或职业< br>< asp:textbox id ="职业"
runat =服务器宽度=" 200" />
< / td>
< td>
< font face =" Verdana" ;大小=2>员工在受伤的情况下工作了多长时间
?< br>< asp:textbox id =" lengthofjob" runat = server />
< / td>
<%--__________________________________________________ __________________________--%>
<% - 第4行 - %>
& nbsp& nbsp
< p>
< asp:Label id = Label1 font-name =" arial"字体大小= QUOT; 10PT" runat =" server" />
<!复制自/ smirnof>
< asp:panel id =" panelSendEmail" runat =" server">
<% - asp:textbox id = runat =" server" / - %>
< br>
< b>您的留言:< / b>< br>
<% - asp:textbox id =" txtMessage" TextMode =" MultiLine"
Columns =" 40"行= QUOT; 10" RUNAT = QUOT;服务器" / - %>
< p>
< asp:button runat =" server" ID = QUOT; btnSendFeedback" Text ="发送
反馈!"
OnClick =" btnSendFeedback_Click" />
< / asp:panel>
< asp:panel id =" panelMailSent" RUNAT = QUOT;服务器" Visible =" False"
电子邮件已发送到您指定的电子邮件地址。
谢谢!
< / asp:panel>
< / form>
< / body>
< / html>
>
vbCrLf &vbCrLf & _
Check2.Text & vbCrLf & _
"</td>" & vbCrLf & vbCrLf & _
"</body>" & vbCrLf & vbCrLf & _
"</html>"
''Specify to use the default Smtp Server
SmtpMail.SmtpServer = ""
''Now, to send the message, use the Send method of the SmtpMail class
SmtpMail.Send(objMM)
panelSendEmail.Visible = false
panelMailSent.Visible = true
End Sub
</script>
</head>
<body>
<table width="750" bgcolor="#E9EDF4" table border="1" cellpadding="3">
<h3><center><font face="Verdana">Wheeler''s Accident Investigation Form</font></h3>
<hr>
<%--__________________________________________________ __________________________--%>
<%--ROW 1--%>
<td width="250" valign="top">
<form runat="server">
<font face="Verdana" Size="2">
Location where accident occurred: <asp:textbox id="Location" runat=server Width="200"/>
</td>
<td align="right" valign="top" width="225">
<font face="Verdana" Size="2">Employer''s Premises
<asp:CheckBox id=Check1 Text="yes" runat="server" />
<asp:CheckBox id=Check2 Text="no" runat="server" />
<br>
Job site
<asp:CheckBox id=Check3 Text="yes" runat="server" />
<asp:CheckBox id=Check4 Text="no" runat="server" />
</td>
<td>
<font face="Verdana" Size="2">Date of accident</font><br>
<asp:textbox id="Date" runat=server Width="100"/>
</td>
<%--__________________________________________________ __________________________--%>
<%--ROW 2--%>
<tr<td>
<font face="Verdana" Size="2">Who was injured?</font><br>
<asp:textbox id="Who" runat=server width="200"/>
</td>
<td align= "left">
<font face="Verdana" Size="2">Employee <asp:CheckBox id=Check5 runat="server" />
<br>
Non-employee <asp:CheckBox id=Check6 runat="server" />
</td>
<td align="right"><font face="Verdana" Size="2">
Time of accident a.m. <asp:textbox id="am" runat=server Width="90"/>
p.m. <asp:textbox id="pm" runat=server Width="90"/>
</TD>
<%--__________________________________________________ __________________________--%>
<%--ROW 3--%>
<tr>
<td>
<font face="Verdana" Size="2">Date of Hire <br<asp:textbox id="Hiredate" runat=server/>
</td>
<td>
<font face="Verdana" Size="2">Job Title or Occupation <br><asp:textbox id="occupation"
runat=server width="200"/>
</td>
<td>
<font face="Verdana" Size="2">How long has employee worked at job where injury
occurred?<br><asp:textbox id="lengthofjob" runat=server/>
</td>
<%--__________________________________________________ __________________________--%>
<%--Row 4--%>
  
<p>
<asp:Label id=Label1 font-name="arial" font-size="10pt" runat="server"/>
<!Copied from /smirnof>
<asp:panel id="panelSendEmail" runat="server">
<%--asp:textbox id= runat="server" /--%>
<br>
<b>Your Message:</b><br>
<%--asp:textbox id="txtMessage" TextMode="MultiLine"
Columns="40" Rows="10" runat="server" /--%>
<p>
<asp:button runat="server" id="btnSendFeedback" Text="Send
Feedback!"
OnClick="btnSendFeedback_Click" />
</asp:panel>
<asp:panel id="panelMailSent" runat="server" Visible="False">
An email has been sent to the email address you specified.
Thanks!
</asp:panel>
</form>
</body>
</html>
发生事故的地点:应该是发生意外的地点
发生: &安培; _
由于你有一个位置文本框,编译器会看到位置变量
,因为你不能添加一个字符串和一个文本框...... 。
---
Patrice
" dancer" < da **** @microsoft.comaécritdansle message de news:
uU ************* @ TK2MSFTNGP05.phx.gbl ...
Location where accident occurred: should be "Location where accident
occured:" & _
And as you have a Location textbox the compiler see the location variable
and as you can''t add a string and a textbox....
---
Patrice
"dancer" <da****@microsoft.coma écrit dans le message de news:
uU*************@TK2MSFTNGP05.phx.gbl...
有人可以告诉我为什么我使用以下代码获取此消息?
编译器错误消息:BC30452:未对类型定义运算符''&''
''String' '和''System.Web.UI.WebControls.TextBox''。
< html>
< head>
<%@Import Namespace =" System.Web.Mail" %>
< script language =" VB" runat =" server">
Sub btnSendFeedback_Click(发送者为对象,e为EventArgs)
''创建一个实例MailMessage类
Dim objMM as New MailMessage()
''设置属性 - 将电子邮件发送给填写
''反馈表。
objMM.To =" xx ***** @ xxxxxxx.com"
objMM.From =" xx ***** @ xxxxxxx.com"
''以html格式发送
objMM.BodyFormat = MailFormat.html
''设置优先级 - 选项为高,低和正常
objMM .Priority = MailPriority.Normal
''设置主题
objMM.Subject ="事故调查表格
''设置身体
objMM.Body = DateTime.Now +" HI &安培; _
"< html>" &安培; vbCrLf& vbCrLf& _
"< head>" &安培; vbCrLf& vbCrLf& _
"< / head>"& vbCrLf& vbCrLf& _
"< body>" &安培; vbCrLf& vbCrLf& _
发生事故的地点:
Location.Text& _
"< br>"& _
Check1.Text& "。" &安培; vbCrLf& vbCrLf& _
vbCrLf& vbCrLf& _
Check2.Text& vbCrLf& _
"< / td>" &安培; vbCrLf& vbCrLf& _
"< / body>" &安培; vbCrLf& vbCrLf& _
"< / html>"
''指定使用默认的Smtp服务器
>
SmtpMail.SmtpServer =""
''现在,要发送消息,请使用SmtpMail类的Send方法
SmtpMail.Send(objMM)
panelSendEmail.Visible = false
panelMailSent.Visible = true
结束子
< / script>
< / head>
< body>
< table width =" 750" BGCOLOR = QUOT;#E9EDF4" table border =" 1" cellpadding =" 3">
< h3>< center>< font face =" Verdana"> Wheeler'的事故调查
表格< / font>< / h3>
< hr>
<%--__________________________________________________ __________________________-- %>
<% - ROW 1 - %>
< td width =" 250" valign =" top">
< form runat =" server">
< font face ="宋体" Size =" 2">
发生事故的位置:< asp:textbox id =" Location" runat = server
Width =" 200" />
< / td>
< ; td align =" right" VALIGN = QUOT;顶" width =" 225">
< font face =" Verdana"大小=" 2">雇主的房产
< asp:CheckBox id = Check1 Text =" yes" RUNAT = QUOT;服务器" />
< asp:CheckBox id = Check2 Text =" no" RUNAT = QUOT;服务器" />
< br>
工作地点
< asp:CheckBox id = Check3 Text =" yes" RUNAT = QUOT;服务器" />
< asp:CheckBox id = Check4 Text =" no" RUNAT = QUOT;服务器" />
< / td>
< td>
< font face =" Verdana"大小=" 2">事故发生日期< / font>< br>
< asp:textbox id ="日期" runat = server Width =" 100" />
< / td>
<%--__________________________________________________ __________________________-- %>
<% - ROW 2 - %>
< tr< td>
< font face =" Verdana" Size =" 2">谁受伤?< / font>< br>
< asp:textbox id =" Who" runat = server width =" 200" />
< / td>
< td align =" left" >
< font face =" Verdana" Size =" 2"> Employee< asp:CheckBox id = Check5
runat =" server" />
< br>
非员工< asp:CheckBox id = Check6 runat =" server" />
< / td>
< td align =" right">< font face ="宋体"大小=" 2">
事故发生时间a.m.< asp:textbox id =" am" runat = server Width =" 90" />
p.m. < asp:textbox id =" pm" runat = server Width =" 90" />
< / TD>
<%--__________________________________________________ __________________________-- %>
<% - ROW 3 - %>
< tr>
>
< td>
< font face =" Verdana"大小=" 2">雇用日期< br< asp:textbox id =" Hiredate"
runat = server />
< / td>
< td>
< font face =" Verdana"大小=" 2">职称或职业< br>< asp:textbox
id ="职业" runat = server width =" 200" />
< / td>
< td>
< font face =" Verdana"大小=" 2">员工在工作中工作了多长时间?
伤害发生?< br>< asp:textbox id =" lengthofjob" runat = server />
< / td>
<%--__________________________________________________ __________________________--%>
<% - 第4行 - %>
& nbsp& nbsp
< p>
< asp:Label id = Label1 font-name =" arial"字体大小= QUOT; 10PT" runat =" server" />
<!复制自/ smirnof>
< asp:panel id =" panelSendEmail" runat =" server">
<% - asp:textbox id = runat =" server" / - %>
< br>
< b>您的留言:< / b>< br>
<% - asp:textbox id =" txtMessage" TextMode =" MultiLine"
Columns =" 40"行= QUOT; 10" RUNAT = QUOT;服务器" / - %>
< p>
< asp:button runat =" server" ID = QUOT; btnSendFeedback" Text ="发送
反馈!"
OnClick =" btnSendFeedback_Click" />
< / asp:panel>
< asp:panel id =" panelMailSent" RUNAT = QUOT;服务器" Visible =" False"
电子邮件已发送到您指定的电子邮件地址。
谢谢!
< / asp:panel>
< / form>
< / body>
< / html>
Can somebody tell me why I get this message with the following code?
Compiler Error Message: BC30452: Operator ''&'' is not defined for types
''String'' and ''System.Web.UI.WebControls.TextBox''.
<html>
<head>
<% @Import Namespace="System.Web.Mail" %>
<script language="VB" runat="server">
Sub btnSendFeedback_Click(sender as Object, e as EventArgs)
''Create an instance of the MailMessage class
Dim objMM as New MailMessage()
''Set the properties - send the email to the person who filled out the
''feedback form.
objMM.To = "xx*****@xxxxxxx.com"
objMM.From = "xx*****@xxxxxxx.com"
''send in html format
objMM.BodyFormat = MailFormat.html
''Set the priority - options are High, Low, and Normal
objMM.Priority = MailPriority.Normal
''Set the subject
objMM.Subject = "Accident Investigation Form"
''Set the body
objMM.Body = DateTime.Now + " HI " & _
"<html>" & vbCrLf & vbCrLf & _
"<head>" & vbCrLf & vbCrLf & _
"</head>"& vbCrLf & vbCrLf & _
"<body>" & vbCrLf & vbCrLf & _
Location where accident occurred:
Location.Text & _
"<br>"& _
Check1.Text & "." & vbCrLf & vbCrLf & _
vbCrLf &vbCrLf & _
Check2.Text & vbCrLf & _
"</td>" & vbCrLf & vbCrLf & _
"</body>" & vbCrLf & vbCrLf & _
"</html>"
''Specify to use the default Smtp Server
SmtpMail.SmtpServer = ""
''Now, to send the message, use the Send method of the SmtpMail class
SmtpMail.Send(objMM)
panelSendEmail.Visible = false
panelMailSent.Visible = true
End Sub
</script>
</head>
<body>
<table width="750" bgcolor="#E9EDF4" table border="1" cellpadding="3">
<h3><center><font face="Verdana">Wheeler''s Accident Investigation
Form</font></h3>
<hr>
<%--__________________________________________________ __________________________--%>
<%--ROW 1--%>
<td width="250" valign="top">
<form runat="server">
<font face="Verdana" Size="2">
Location where accident occurred: <asp:textbox id="Location" runat=server
Width="200"/>
</td>
<td align="right" valign="top" width="225">
<font face="Verdana" Size="2">Employer''s Premises
<asp:CheckBox id=Check1 Text="yes" runat="server" />
<asp:CheckBox id=Check2 Text="no" runat="server" />
<br>
Job site
<asp:CheckBox id=Check3 Text="yes" runat="server" />
<asp:CheckBox id=Check4 Text="no" runat="server" />
</td>
<td>
<font face="Verdana" Size="2">Date of accident</font><br>
<asp:textbox id="Date" runat=server Width="100"/>
</td>
<%--__________________________________________________ __________________________--%>
<%--ROW 2--%>
<tr<td>
<font face="Verdana" Size="2">Who was injured?</font><br>
<asp:textbox id="Who" runat=server width="200"/>
</td>
<td align= "left">
<font face="Verdana" Size="2">Employee <asp:CheckBox id=Check5
runat="server" />
<br>
Non-employee <asp:CheckBox id=Check6 runat="server" />
</td>
<td align="right"><font face="Verdana" Size="2">
Time of accident a.m. <asp:textbox id="am" runat=server Width="90"/>
p.m. <asp:textbox id="pm" runat=server Width="90"/>
</TD>
<%--__________________________________________________ __________________________--%>
<%--ROW 3--%>
<tr>
<td>
<font face="Verdana" Size="2">Date of Hire <br<asp:textbox id="Hiredate"
runat=server/>
</td>
<td>
<font face="Verdana" Size="2">Job Title or Occupation <br><asp:textbox
id="occupation" runat=server width="200"/>
</td>
<td>
<font face="Verdana" Size="2">How long has employee worked at job where
injury occurred?<br><asp:textbox id="lengthofjob" runat=server/>
</td>
<%--__________________________________________________ __________________________--%>
<%--Row 4--%>
  
<p>
<asp:Label id=Label1 font-name="arial" font-size="10pt" runat="server"/>
<!Copied from /smirnof>
<asp:panel id="panelSendEmail" runat="server">
<%--asp:textbox id= runat="server" /--%>
<br>
<b>Your Message:</b><br>
<%--asp:textbox id="txtMessage" TextMode="MultiLine"
Columns="40" Rows="10" runat="server" /--%>
<p>
<asp:button runat="server" id="btnSendFeedback" Text="Send
Feedback!"
OnClick="btnSendFeedback_Click" />
</asp:panel>
<asp:panel id="panelMailSent" runat="server" Visible="False">
An email has been sent to the email address you specified.
Thanks!
</asp:panel>
</form>
</body>
</html>
这篇关于操作员'和'未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!