D
dancer
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 = "(e-mail address removed)"
objMM.From = "(e-mail address removed)"
'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>
<aspanel 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" />
</aspanel>
<aspanel id="panelMailSent" runat="server" Visible="False">
An email has been sent to the email address you specified.
Thanks!
</aspanel>
</form>
</body>
</html>
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 = "(e-mail address removed)"
objMM.From = "(e-mail address removed)"
'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>
<aspanel 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" />
</aspanel>
<aspanel id="panelMailSent" runat="server" Visible="False">
An email has been sent to the email address you specified.
Thanks!
</aspanel>
</form>
</body>
</html>