How to Formate data in Data Table?

Posted by Naimishforu under VB.NET on 3/28/2011 | Points: 10 | Views : 3117 | Status : [Member] [MVP] | Replies : 2
Dim ListData As DataTable
Dim InputDataSet() As DataSet

ListData = InputDataSet.Tables("MyTableData")

I am getting data in ListData as below,

12.12345
13.12234
14.23454

I want to formate the data as,

12.12
13.12
14.23

:(

Thanks,
Naimish
http://dotnetinterview.zxq.net/
http://naimishpandya.blogspot.in/



Responses

Posted by: T.saravanan on: 3/28/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi Naimish,

Try this...

for(int x=0; x < dtData.Rows.Count; x++)

{
dtData.Rows[x] ["Value"] = decimal.parse(dtData.Rows[x] ["Value"].ToString()).ToString("F2");
}





Thanks,
T.Saravanan

Naimishforu, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vforvijay on: 3/29/2011 [Member] Starter | Points: 25

Up
0
Down
hi .. try this
inside the loop give th code ..

Format number("value",2)



Naimishforu, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response