is there a best code solution so that there is no error in the vb.net?. is there a possibility of an error in the conversion? I provide a share link because I failed continuously to post the code c #.
'code output in VB.NET
Private Shared Function GenerateReceiptTemplate() As String
Return "
<center>
<font size='24px'><b>WcDonalds</b></font><br/> ''>' expected
<span>[email protected]</span> 'Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.
</center> 'Identifier expected
<br/><br/> ''>' expected
<table width='100%'> ''>' expected
<thead>
<tr>
<th align='left'>Product Name</th> ''>' expected
<th>Quantity</th> 'Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.
<th align='right'>Subtotal</th> ''>' expected
</tr> 'Identifier expected
</thead> 'Identifier expected
<tbody>
<Orders/> ''>' expected
</tbody> 'Identifier expected
</table> 'Identifier expected
<br/> ''>' expected
<center>---------------------------------------</center> 'Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.
<br/> ''>' expected
Total: <b><Total/></b><br/> ''>' expected
Cash: <b><Cash/></b><br/> ''>' expected
Change: <b><Change/></b><br/> ''>' expected
<br/> ''>' expected
Transaction ID: #<Id/><br/> 'Syntax error & Method arguments must be enclosed in parentheses & 'Transaction' is a type and cannot be used as an expression & 'If', 'ElseIf', 'Else', 'End If', 'Const', or 'Region' expected & 'ID' is not declared. It may be inaccessible due to its protection level
Cashier: <Cashier/><br/> ''>' expected
Date: <Date/><br/> 'Keyword is not valid as an identifier & 'Date' is a type and cannot be used as an expression & '.' expected
<br/> ''>' expected
<center>---------------------------------------</center> 'Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.
<br/> ''>' expected
<center><b>Thanks for visiting WcDonalds</b></center> 'Attribute specifier is not a complete statement. Use a line continuation to apply the attribute to the following statement.
" 'Syntax error
End Function
thanks jack
CodePudding user response:
In vb.net code editor you can use the HTML language, just enter the start tag
of an element like the root <html>
, hit Enter and the editor will append the end tag </html>
for you. You can then call </html>.ToString()
to return the HTML block as string
.
In the GenerateReceiptTemplate
function, replace everything with:
Private Shared Function GenerateReceiptTemplate() As String
Return <html>
</html>.ToString()
End Function
From the c# file, Copy the HTML between the two double quotes "..."
and paste it in the <html></html>
block.
Private Shared Function GenerateReceiptTemplate() As String
Return <html>
<center>
<font size='24px'><b>WcDonalds</b></font><br/>
<span>[email protected]</span>
</center>
<br/><br/>
<table width='100%'>
<thead>
<tr>
<th align='left'>Product Name</th>
<th align='center'>Quantity</th>
<th align='right'>Subtotal</th>
</tr>
</thead>
<tbody>
<Orders/>
</tbody>
</table>
<br/>
<center>---------------------------------------</center>
<br/>
Total: <b><Total/></b><%= qty %><br/>
Cash: <b><Cash/></b><%= someSharedField %><br/>
Change: <b><Change/></b><%= someParam %><br/>
<br/>
Transaction ID: #<Id/><br/>
Cashier: <Cashier/><br/>
Date: <Date/><br/>
<br/>
<center>---------------------------------------</center>
<br/>
<center><b>Thanks For visiting WcDonalds</b></center>
</html>.ToString()
End Function
That's it all.
Note: Not sure whether VS2010, VS2012 frameworks support this feature. Time to move on!