PC Review


Reply
Thread Tools Rate Thread

How to access data from one datagrid to another in VB.Net

 
 
Coleen
Guest
Posts: n/a
 
      12th Aug 2004
Hi All :-)

I have a Fro?next loop where I have to calculate a grand total. I need to use that grand total to calculate percentages of data from the same For/Next loop. I can't get the grand total until the loop completes, so I have created another datagrid to dump the value of the grand total into. Now, I need to get the total from that datagrid and use it in my original For/Next Loop. Any suggestions on how to do this?

I have tried:

ld_pct_125_tot_gtr_fy_hh = CDbl(dt_grand_totals.Rows.Item(0).ToString)
where dt_grand_totals is my datagrid with the value I need to get to store in the variable ld_pct_125_tot_gtr_fy_hh

How can I get that value back from the other datagrid into my variable?

TIA



Coleen



 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      12th Aug 2004
Coleen,

Did you already look at this?

Datatable.compute
http://msdn.microsoft.com/library/de...mputetopic.asp

Maybe it helps easier?

Cor


 
Reply With Quote
 
Coleen
Guest
Posts: n/a
 
      12th Aug 2004
Well, yes and no :-)

This works if you are connecting to an SQL database using a dataset. We connect to a DB2 database using an RPC to a COBOL program...very difficult to get the same results this way as you can connecting to a SQL DB! I don't use a dataset to be able to call the table column name. According to the example I would use:

Dataset1.Tables("TableName").Columns("ColumnName").Expression = "ExpressionName"

If I could call the datagrid in the same fashion it might work for me. I tried:

dt_grand_totals.TableName("dtg_grand_totals").Columns("ld_act_125_gtr_fy_hh_avg_grnd_tot").Expression = "ld_pct_125_tot_gtr_fy_hh" where dt_grand_totals is the datatable, dtg_grand_totals is the datagrid name, ld_act_125_gtr_fy_hh_avg_grnd_tot is the column name and ld_pct_125_tot_gtr_fy_hh is the expression or variable that I want to store the value in.

This gives me the "Blue Squiggly" error "Public Overloads Property TableName() AS String' has no parameters and its return type cannot be indexed"

Any other suggestions?

Thanks :-)

Coleen


"Cor Ligthert" <(E-Mail Removed)> wrote in message news:%(E-Mail Removed)...
> Coleen,
>
> Did you already look at this?
>
> Datatable.compute
> http://msdn.microsoft.com/library/de...mputetopic.asp
>
> Maybe it helps easier?
>
> Cor
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Access db fails to display data in datagrid after db exceeds 600k =?Utf-8?B?Z2xlbm4=?= Microsoft ASP .NET 0 22nd Jun 2006 01:11 PM
Access db fails to display data in datagrid after db exceeds 600k =?Utf-8?B?Z2xlbm4=?= Microsoft ADO .NET 0 22nd Jun 2006 01:10 PM
Data Access Pages Datagrid Transfer =?Utf-8?B?QW5keQ==?= Microsoft Access 0 4th Aug 2005 04:33 PM
How to add datagrid to data access page =?Utf-8?B?UmF5IENoYXBtYW4=?= Microsoft Access 0 19th Jul 2005 05:59 PM
Access Hidden Colum Data in DataGrid Scott D Microsoft Dot NET Framework 0 25th May 2004 02:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:16 PM.