ARGH! Converting the value of a dtatable from a string to a Double
From: Coleen (coleenholley_at_yaho.com)
Date: 08/12/04
- Next message: Kirk Graves: "Re: Hide a form as it loads"
- Previous message: Herfried K. Wagner [MVP]: "Re: Compiler Fun"
- Next in thread: jim: "Re: ARGH! Converting the value of a dtatable from a string to a Double"
- Reply: jim: "Re: ARGH! Converting the value of a dtatable from a string to a Double"
- Reply: Cor Ligthert: "Re: ARGH! Converting the value of a dtatable from a string to a Double"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 12 Aug 2004 16:56:54 -0700
Hi All :-)
I found the way to get my column sum (Thanks Cor I did it a little different, but the result is what I wanted) I used:
dt_stat_report_3b.Columns.Add(New DataColumn("Sum", GetType(Double), "sum(Column_10_ld_act_125_gtr_fy_fy_hh_avg)"))
where dt_stat_report_3b is my datatable, Sum is my column name and sum(Column_10_ld_act_125_gtr_fy_fy_hh_avg) is the sum of the column I needed. This Does return me the correct value in the column I've specified, but now I need that value to be stored in a variable that I can use in another calculation. I've tried:
ld_act_125_gtr_fy_hh_avg_grnd_tot = CDbl(dt_stat_report_3b.Columns.Item(15).ToString)
Where ld_act_125_gtr_fy_hh_avg_grnd_tot is the variable and is declared as a Double. This returns an error that the input string was not in the correct format. What I really want to do is get the value from that column and populate the variable with it. I CAN'T get the CDbl() to work! I've tried to do it as CDbl(), I tried System.Convert.ToDouble() but I ALWAYS get an error that the input string was in an incorrect format. I just want the VALUE from the Column that I've summed! Please, can someone explain how to get the string to convert to a double or how to get dt_stat_report_3b.Columns.Item(15).Value? Value is not an option and I don't know what else to try!
Any help is GREATLY Appreciated, since I have spent all day on this problem!
Thanks!
Coleen
- Next message: Kirk Graves: "Re: Hide a form as it loads"
- Previous message: Herfried K. Wagner [MVP]: "Re: Compiler Fun"
- Next in thread: jim: "Re: ARGH! Converting the value of a dtatable from a string to a Double"
- Reply: jim: "Re: ARGH! Converting the value of a dtatable from a string to a Double"
- Reply: Cor Ligthert: "Re: ARGH! Converting the value of a dtatable from a string to a Double"
- Messages sorted by: [ date ] [ thread ]