使用VB.Net格式化HTML表 [英] Formatting an HTML table using VB.Net

查看:87
本文介绍了使用VB.Net格式化HTML表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好:-)


我使用VB.Net和HTML填充的HTML表有一个奇怪的格式问题。

这里是我正在尝试格式化的单元格的代码片段:


Dim ld_tot_pet_clean_fee_calc As Double

ld_tot_pet_clean_fee_calc = li_net_total_calc * 0.0075

ld_tot_pet_clean_fee = lo_misc_func.FormatMC(ld_tot_pet_clean_fee_calc," D")

会话(" tot_pet_clean_fee")= lo_misc_func.FormatMC(ld_tot_pet_clean_fee," D")

Response.Write(lo_misc_func.FormatMC(ld_tot_pet_cl ean_fee_calc," D"))

lo_misc_func.FormatMC调用将变量格式化为整数,长整数或双精度的函数(" I,L或D)。正如你所看到的,我正在尝试将其格式化为双倍。这个计算的值是114.80 - 我无法将变量格式化为.80,它不会在8之后格式化0。函数中的格式为:


案例D

ls_format =格式(CDbl(ls_format)," ##,## 0。#0")

返回ls_format


之前我从未遇到过这种格式化功能的问题。单元格的值填充在表格的html中:

< td class =" table" style =" FONT-WEIGHT:bold width =" 75"><%= ld_tot_pet_clean_fee%>< / td>

奇怪的是,在另一个具有完全相同的格式和表结构的表中,它工作得很好。此外,正如您所看到的,我已经尝试通过执行response.write来确保它正在工作 - 这非常有效。关于如何强制它格式化0的任何建议?


TIA


Coleen

Hi all :-)

I have a weird formatting problem with an HTML table that I am populating using VB.Net and HTML.
Here is the snippet of code for the cell I''m trying to format:

Dim ld_tot_pet_clean_fee_calc As Double
ld_tot_pet_clean_fee_calc = li_net_total_calc * 0.0075
ld_tot_pet_clean_fee = lo_misc_func.FormatMC(ld_tot_pet_clean_fee_calc, "D")
Session("tot_pet_clean_fee") = lo_misc_func.FormatMC(ld_tot_pet_clean_fee, "D")
Response.Write(lo_misc_func.FormatMC(ld_tot_pet_cl ean_fee_calc, "D"))

lo_misc_func.FormatMC calls a function that formats a variable into an Integer, Long or Double ("I", "L", or "D"). As you can see, I''m trying to format this as a double. The value for this calculation is 114.80 - I can not get the variable to format correctly as .80, it will not format the 0 after the 8. The format in the function is done as:

Case "D"
ls_format = Format(CDbl(ls_format), "##,##0.#0")
Return ls_format

I have never had problems with this format function before. The value of the cell is populated in the html of the table as:
<td class="table" style="FONT-WEIGHT: bold" width="75"><%=ld_tot_pet_clean_fee%></td>
The weird thing is that in another table with the exact same formatting and table structure, it works just fine. Also, as you can see, I''ve tried to make certain that it is working by doing a response.write - which works perfectly. Any suggestion as to how I can force it to format the 0?

TIA

Coleen

推荐答案

尝试使用Decimal而不是Double。


-


OHM(Terry Burns)

。 。 。单手人。 。

如果你需要我的电子邮件,请问我


当你不知道自己在做什么时,过得很快


" Coleen" <共********** @ yaho.com>在留言新闻中写道:Oj ************* @ TK2MSFTNGP14.phx.gbl ...

大家好:-)


我使用VB.Net和HTML填充的HTML表有一个奇怪的格式问题。

这是我正在尝试格式化的单元格的代码片段:


Dim ld_tot_pet_clean_fee_calc As Double

ld_tot_pet_clean_fee_calc = li_net_total_calc * 0.0075

ld_tot_pet_clean_fee = lo_misc_func.FormatMC(ld_tot_pet_clean_fee_calc," D")

会话(" tot_pet_clean_fee")= lo_misc_func.FormatMC(ld_tot_pet_clean_fee," D")

Response.Write(lo_misc_func.FormatMC(ld_tot_pet_cl ean_fee_calc," D")) )
lo_misc_func.FormatMC调用将变量格式化为整数,长整数或双精度(I,L或D)的函数。正如你所看到的,我正在尝试将其格式化为双倍。这个计算的值是114.80 - 我无法将变量格式化为.80,它不会在8之后格式化0。函数中的格式为:


案例D

ls_format =格式(CDbl(ls_format)," ##,## 0。#0")

返回ls_format


之前我从未遇到过这种格式化功能的问题。单元格的值填充在表格的html中:

< td class =" table" style =" FONT-WEIGHT:bold width =" 75"><%= ld_tot_pet_clean_fee%>< / td>

奇怪的是,在另一个具有完全相同的格式和表结构的表中,它工作得很好。此外,正如您所看到的,我已经尝试通过执行response.write来确保它正在工作 - 这非常有效。关于如何强制它格式化0的任何建议?


TIA


Coleen
Try using Decimal instead of Double.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don''t know what you''re doing

"Coleen" <co**********@yaho.com> wrote in message news:Oj*************@TK2MSFTNGP14.phx.gbl...
Hi all :-)

I have a weird formatting problem with an HTML table that I am populating using VB.Net and HTML.
Here is the snippet of code for the cell I''m trying to format:

Dim ld_tot_pet_clean_fee_calc As Double
ld_tot_pet_clean_fee_calc = li_net_total_calc * 0.0075
ld_tot_pet_clean_fee = lo_misc_func.FormatMC(ld_tot_pet_clean_fee_calc, "D")
Session("tot_pet_clean_fee") = lo_misc_func.FormatMC(ld_tot_pet_clean_fee, "D")
Response.Write(lo_misc_func.FormatMC(ld_tot_pet_cl ean_fee_calc, "D"))

lo_misc_func.FormatMC calls a function that formats a variable into an Integer, Long or Double ("I", "L", or "D"). As you can see, I''m trying to format this as a double. The value for this calculation is 114.80 - I can not get the variable to format correctly as .80, it will not format the 0 after the 8. The format in the function is done as:

Case "D"
ls_format = Format(CDbl(ls_format), "##,##0.#0")
Return ls_format

I have never had problems with this format function before. The value of the cell is populated in the html of the table as:
<td class="table" style="FONT-WEIGHT: bold" width="75"><%=ld_tot_pet_clean_fee%></td>
The weird thing is that in another table with the exact same formatting and table structure, it works just fine. Also, as you can see, I''ve tried to make certain that it is working by doing a response.write - which works perfectly. Any suggestion as to how I can force it to format the 0?

TIA

Coleen


嗨Coleen


我没试过这个,但如果我这样做,我会用


" #,## 0.00"


HTH


Charles

" Coleen" <共********** @ yaho.com>在消息中写道

新闻:Oj ************* @ TK2MSFTNGP14.phx.gbl ...

大家好: - )


我有一个奇怪的格式化问题,我正在使用VB.Net和HTML填充



这是我试图格式化的单元格代码片段:


Dim ld_tot_pet_clean_fee_calc双倍

ld_tot_pet_clean_fee_calc = li_net_total_calc * 0.0075

ld_tot_pet_clean_fee = lo_misc_func.FormatMC(ld_tot_pet_clean_fee_calc,D)

会话(tot_pet_clean_fee)= lo_misc_func.FormatMC(ld_tot_pet_clean_fee,

D)

Response.Write(lo_misc_func.FormatMC(ld_tot_pet_cl ean_fee_calc," D"))

lo_misc_func.FormatMC调用一个函数,将变量格式化为

整数,长或双(I,L或D)。正如你所看到的,我正在尝试以b $ b格式将其作为双倍格式。这个计算的值是114.80 - 我可以

没有得到变量格式正确的.80,它不会格式化8

之后的8格式。该功能如下:


案例D

ls_format =格式(CDbl(ls_format),&##,## 0。# 0")

返回ls_format


之前我从未遇到过此格式函数的问题。单元格的值在表格的html中填充为:

< td class =" table" style =" FONT-WEIGHT:bold"

width =" 75"><%= ld_tot_pet_clean_fee%>< / td>

怪异的东西是在另一个表中具有完全相同的格式和表b / b
表结构,它工作得很好。另外,正如你所看到的那样,我已经尝试过确定它是通过做一个response.write工作来确定它的工作原理

完美无缺。关于如何强制它格式化0的任何建议?


TIA


Coleen
Hi Coleen

I haven''t tried this, but if I were doing it I would use

"#,##0.00"

HTH

Charles
"Coleen" <co**********@yaho.com> wrote in message
news:Oj*************@TK2MSFTNGP14.phx.gbl...
Hi all :-)

I have a weird formatting problem with an HTML table that I am populating
using VB.Net and HTML.
Here is the snippet of code for the cell I''m trying to format:

Dim ld_tot_pet_clean_fee_calc As Double
ld_tot_pet_clean_fee_calc = li_net_total_calc * 0.0075
ld_tot_pet_clean_fee = lo_misc_func.FormatMC(ld_tot_pet_clean_fee_calc, "D")
Session("tot_pet_clean_fee") = lo_misc_func.FormatMC(ld_tot_pet_clean_fee,
"D")
Response.Write(lo_misc_func.FormatMC(ld_tot_pet_cl ean_fee_calc, "D"))

lo_misc_func.FormatMC calls a function that formats a variable into an
Integer, Long or Double ("I", "L", or "D"). As you can see, I''m trying to
format this as a double. The value for this calculation is 114.80 - I can
not get the variable to format correctly as .80, it will not format the 0
after the 8. The format in the function is done as:

Case "D"
ls_format = Format(CDbl(ls_format), "##,##0.#0")
Return ls_format

I have never had problems with this format function before. The value of
the cell is populated in the html of the table as:
<td class="table" style="FONT-WEIGHT: bold"
width="75"><%=ld_tot_pet_clean_fee%></td>
The weird thing is that in another table with the exact same formatting and
table structure, it works just fine. Also, as you can see, I''ve tried to
make certain that it is working by doing a response.write - which works
perfectly. Any suggestion as to how I can force it to format the 0?

TIA

Coleen


我会试试,谢谢。看起来很奇怪,这在使用双数据类型的其他地方完美运行。

One Handed Man(OHM - Terry Burns) < news.microsoft.com>在消息新闻中写道:%2 **************** @ TK2MSFTNGP12.phx.gbl ...

尝试使用Decimal而不是Double。


-


OHM(特里伯恩斯)

。 。 。单手人。 。

如果你需要我的电子邮件,请问我


当你不知道自己在做什么时,过得很快


" Coleen" <共********** @ yaho.com>在留言新闻中写道:Oj ************* @ TK2MSFTNGP14.phx.gbl ...

大家好:-)


我使用VB.Net和HTML填充的HTML表有一个奇怪的格式问题。

这是我正在尝试格式化的单元格的代码片段:


Dim ld_tot_pet_clean_fee_calc As Double

ld_tot_pet_clean_fee_calc = li_net_total_calc * 0.0075

ld_tot_pet_clean_fee = lo_misc_func.FormatMC(ld_tot_pet_clean_fee_calc," D")

会话(" tot_pet_clean_fee")= lo_misc_func.FormatMC(ld_tot_pet_clean_fee," D")

Response.Write(lo_misc_func.FormatMC(ld_tot_pet_cl ean_fee_calc," D")) )
lo_misc_func.FormatMC调用将变量格式化为整数,长整数或双精度(I,L或D)的函数。正如你所看到的,我正在尝试将其格式化为双倍。这个计算的值是114.80 - 我无法将变量格式化为.80,它不会在8之后格式化0。函数中的格式为:


案例D

ls_format =格式(CDbl(ls_format)," ##,## 0。#0")

返回ls_format


之前我从未遇到过这种格式化功能的问题。单元格的值填充在表格的html中:

< td class =" table" style =" FONT-WEIGHT:bold width =" 75"><%= ld_tot_pet_clean_fee%>< / td>

奇怪的是,在另一个具有完全相同的格式和表结构的表中,它工作得很好。此外,正如您所看到的,我已经尝试通过执行response.write来确保它正在工作 - 这非常有效。关于如何强制它格式化0的任何建议?


TIA


Coleen
I will try that, thanks. It just seems strange that this works perfectly in other places using a double data type.
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message news:%2****************@TK2MSFTNGP12.phx.gbl...
Try using Decimal instead of Double.

--

OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me

Time flies when you don''t know what you''re doing

"Coleen" <co**********@yaho.com> wrote in message news:Oj*************@TK2MSFTNGP14.phx.gbl...
Hi all :-)

I have a weird formatting problem with an HTML table that I am populating using VB.Net and HTML.
Here is the snippet of code for the cell I''m trying to format:

Dim ld_tot_pet_clean_fee_calc As Double
ld_tot_pet_clean_fee_calc = li_net_total_calc * 0.0075
ld_tot_pet_clean_fee = lo_misc_func.FormatMC(ld_tot_pet_clean_fee_calc, "D")
Session("tot_pet_clean_fee") = lo_misc_func.FormatMC(ld_tot_pet_clean_fee, "D")
Response.Write(lo_misc_func.FormatMC(ld_tot_pet_cl ean_fee_calc, "D"))

lo_misc_func.FormatMC calls a function that formats a variable into an Integer, Long or Double ("I", "L", or "D"). As you can see, I''m trying to format this as a double. The value for this calculation is 114.80 - I can not get the variable to format correctly as .80, it will not format the 0 after the 8. The format in the function is done as:

Case "D"
ls_format = Format(CDbl(ls_format), "##,##0.#0")
Return ls_format

I have never had problems with this format function before. The value of the cell is populated in the html of the table as:
<td class="table" style="FONT-WEIGHT: bold" width="75"><%=ld_tot_pet_clean_fee%></td>
The weird thing is that in another table with the exact same formatting and table structure, it works just fine. Also, as you can see, I''ve tried to make certain that it is working by doing a response.write - which works perfectly. Any suggestion as to how I can force it to format the 0?

TIA

Coleen


这篇关于使用VB.Net格式化HTML表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆