Formatting an HTML table using VB.Net

  • Thread starter Thread starter Coleen
  • Start date Start date
C

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_clean_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
 
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

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_clean_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
 
Hi Coleen

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

"#,##0.00"

HTH

Charles


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_clean_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
 
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 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

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_clean_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
 
Okay, I finally got a chance to go back and try your suggestion (after all this is just formatting, not a "major" problem) - it doesn't make a difference. It still won't display it as .80. So, I went back to the calculation and tied formatting at the calculation level - it still doesn't work! This is really weird, so I'm checking into why one cell formatted in the HTML table directly above this one formats properly, and this one doesn't...

If you have any other suggestions, I'm open...

Thanks!
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message 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

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_clean_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

Did you try my suggestion?

Charles


Okay, I finally got a chance to go back and try your suggestion (after all
this is just formatting, not a "major" problem) - it doesn't make a
difference. It still won't display it as .80. So, I went back to the
calculation and tied formatting at the calculation level - it still doesn't
work! This is really weird, so I'm checking into why one cell formatted in
the HTML table directly above this one formats properly, and this one
doesn't...

If you have any other suggestions, I'm open...

Thanks!
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
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

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_clean_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
 
The only other thing I can suggest is to widen the cell width, perhaps it's marginally too narrow and consequently not being displayed

--

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

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

Okay, I finally got a chance to go back and try your suggestion (after all this is just formatting, not a "major" problem) - it doesn't make a difference. It still won't display it as .80. So, I went back to the calculation and tied formatting at the calculation level - it still doesn't work! This is really weird, so I'm checking into why one cell formatted in the HTML table directly above this one formats properly, and this one doesn't...

If you have any other suggestions, I'm open...

Thanks!
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message 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

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_clean_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
 
Hi Charles,
Yes, I did try using the regular format process. The really weird thing is
that I can get it to format correctly in the Response.write (using both the
function and the format process), but as soon as I send it to the variable
it truncates it. I will try OHM's suggestion to widen the cell; however,
the cell in the table above is the same size and the value in it display
just fine. I have no idea why the zero won't display correctly. I'm
looking at the entire code for the HTML table now, to see if maybe the
author put some formatting in the HTML. I'm not the original programmer on
this, I'm just doing maintenance...

Thanks for all the suggestions...

Coleen
 
For anyone wanting to know how I solved this problem, here it is:

The imbedded code <%=variablename%> strips the formatting off when putting it in the table, so even though it looked like the variables in other cells were formatting correctly, they weren't. It strips the 0's off of the end, so I solved this by removing the <%variablename%> referrrences:
<td class="table" style="FONT-WEIGHT: bold" width="75"><%=ld_tot_pet_clean_fee%></td>
and putting the variables in the cell via VB in the code behind:
tbl_cleanup.Rows(9).Cells(1).Text = lo_misc_func.FormatMC(ld_tot_pet_clean_fee, "D")
works perfectly! So if anyone is populating variables in the imbedded HTML, be aware that it strips the formatting...

Thanks,

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_clean_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
 
Had to be something like that didnt it. I hate problems like this.


At least you cracked it.

--

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

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

For anyone wanting to know how I solved this problem, here it is:

The imbedded code <%=variablename%> strips the formatting off when putting it in the table, so even though it looked like the variables in other cells were formatting correctly, they weren't. It strips the 0's off of the end, so I solved this by removing the <%variablename%> referrrences:
<td class="table" style="FONT-WEIGHT: bold" width="75"><%=ld_tot_pet_clean_fee%></td>
and putting the variables in the cell via VB in the code behind:
tbl_cleanup.Rows(9).Cells(1).Text = lo_misc_func.FormatMC(ld_tot_pet_clean_fee, "D")
works perfectly! So if anyone is populating variables in the imbedded HTML, be aware that it strips the formatting...

Thanks,

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_clean_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
 
Thanks!
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message Had to be something like that didnt it. I hate problems like this.


At least you cracked it.

--

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

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

For anyone wanting to know how I solved this problem, here it is:

The imbedded code <%=variablename%> strips the formatting off when putting it in the table, so even though it looked like the variables in other cells were formatting correctly, they weren't. It strips the 0's off of the end, so I solved this by removing the <%variablename%> referrrences:
<td class="table" style="FONT-WEIGHT: bold" width="75"><%=ld_tot_pet_clean_fee%></td>
and putting the variables in the cell via VB in the code behind:
tbl_cleanup.Rows(9).Cells(1).Text = lo_misc_func.FormatMC(ld_tot_pet_clean_fee, "D")
works perfectly! So if anyone is populating variables in the imbedded HTML, be aware that it strips the formatting...

Thanks,

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_clean_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
 
Back
Top