A
Aaron said:I use this site to translate C# into VB.NET
http://www.kamalpatel.net/ConvertCSharp2VB.aspx
orColeen said:Hi Alvin, and Thanks
I could really use some help here. I don't know C# and I am having trouble
deciphering your code into VB. Would it be possible for you to give me an
example in VB? I can NOT get this to work, and I have spent 4 days on it!!!
This is ridiculous! I would REALLY appreciate ANY help that you or anyone
else can give. We are using VB.Net in a Web form, with an aspx.net
datagrid.
TIA
Coleen
"This is EASILY done in Excel:
and it is EASIER in .net"
in your itemdatabound event handler
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
int total = Int32.Parse( ds.Tables[0].Compute("Sum(["+Column
A+"])",String.Empty));
//calculate column b for each row
e.Item.Cells[2].Text = int32.Parse(e.Item.Cells[2].Text) / total;
}
once you understand what you are working with, you can compress it down into
this verse
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
e.Item.Cells[2].Text = int32.Parse(e.Item.Cells[2].Text) /
Int32.Parse( ds.Tables[0].Compute("Sum(["+Column A+"])",String.Empty));
i'd recommend a catch block because int32.parse throws on empty fieldsu
really should use double.tryparse ...
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.