是否有最好的代碼解決方案,以便在 vb.net 中沒有錯誤?轉換中是否有可能出錯?我提供了一個分享鏈接,因為我一直未能發布代碼 c#。
鏈接 GOOGLE 驅動器代碼 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
謝謝杰克
uj5u.com熱心網友回復:
在VB.net代碼編輯器您可以使用 HTML 語言,只需輸入
元素的開始標記,如 root <html>,點擊Enter,編輯器將為您附加結束標記</html>。然后,您可以呼叫</html>.ToString()以將 HTML 塊回傳為string.
在GenerateReceiptTemplate函式中,將所有內容替換為:
Private Shared Function GenerateReceiptTemplate() As String
Return <html>
</html>.ToString()
End Function
來自C#檔案,復制兩個雙引號之間的 HTML"..."并將其粘貼到<html></html>塊中。
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
就是這樣。
注意:不確定 VS2010、VS2012 框架是否支持此功能。分手后要往前看了!
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/496064.html
