Showing posts with label body. Show all posts
Showing posts with label body. Show all posts

Saturday, March 31, 2012

subroutines or functions wont work.

any time i try coding a function or a subrouting the page won't run. iget error msg: BC30289: Statement cannot appear within a method body. End of method assumed.

here's my code. PLEASE HELP!, what am i typing wrong??
<%@dotnet.itags.org. Page Language="VB" %>
<script runat="server"
' Insert page code here
'

</script>
<html>
<head>
</head>
<body>
<form runat="server">
<%
Dim arrPrimeNos, arrNames
Sub subPrintArray(arrToPrint, iStartValue, iStopValue)
Dim iCounter
For iCounter = iStartValue to iStopValue
Response.Write(arrToPrint(iCounter))
Response.Write("<BR>")
Next
End Sub
arrPrimeNos=Array(2,3,5)
arrName=Array("John","Mary","Bolek")

'call subroutine
subPrintArray arrNames, 2, 3
%
</form>
</body>
</html>1. You'd better put the server side code in <script> tag if you use inline coding. Using <% %> is not a .net way.

2. You can only call a method (function, subrouting or event handler) from a method (function, subrouting or event handler), so your code need to change like this:


<%@. Page Language="VB" %>
<script runat="server"
Sub page_load

Dim arrPrimeNos() As Integer = {2, 3, 5}
Dim arrNames() As String = {"John", "Mary", "Bolek"}

'call subroutine
subPrintArray arrNames, 2, 3
End Sub

Sub subPrintArray(arrToPrint, iStartValue, iStopValue)
Dim iCounter
For iCounter = iStartValue to iStopValue
Response.Write(arrToPrint(iCounter))
Response.Write("<BR>")
Next
End Sub

</script>
<html>
<head>
</head>
<body>
<form runat="server">
</form>
</body>
</html>


thank you very much

Saturday, March 24, 2012

Super Annoying ! Character in my HTML Email!!

I have a web form that allows emailing of a predefined HTML body. I have tried different formatting and deleting of certain text, but when the Email is received, there is always a '!' (exclamation mark) or two within the text.

How do I get around this annoying feature! What am I doing wrong?

Your help will be greatly appreciated.I have been perusing tons of documentation and even rewrote my code, but still nothing.

I am thinking of this: is there any way to display the contents of a HTML page on the body? Essentially, this is what I'm doing. I just had a bunch of HTML tags in my body of the mailMessage.

Your help will be greatly appreciated.
Hi,


Dim objMM As New System.Web.Mail.MailMessage
objMM.BodyFormat = Mail.MailFormat.Html

More info

HTH
shaji:

Thanks for your reply. I already have that code in my page. How can I include a URL has the whole body of the email message, that is what I am looking for.

Can anyone help?
OK -- this is what I've been noticing with my mail application. When I attach an HTML body to my MailMessage .Body section and the email retrieves email addresses from a database via a datareader, the emails themselves come back with 'garbage' displayed as random '!' marks in my text.

If I put the same HTML Body in an HTML document by itself, the format is beautiful, clean, and what I'm looking for.

So this brings me to conclude that somehow, the server is throwing in some 'garbage' into the body of my MailMessage .Body. Thus now, I have come to the conclusion that I can't alleviate this problem since it seems to be out of my hands.

I was thinking there must be a way to have the Body of the email to display the web page, i.e. that HTML document.

Please help.
Hi net123,

Try String.Replace() function.

YourMailBody.Replace("!", "")

HTH
Maybe your server is converting some caracter he does'nt understand to a "!"
Can you see a pattern on where those "!" are added ?