473,385 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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

Nov 21 '05 #1
2 2823
Coleen,

Did you already look at this?

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

Maybe it helps easier?

Cor
Nov 21 '05 #2
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").Colu mns("ld_act_125_gtr_fy_hh_avg_grnd_tot").Expressio n = "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" <no**********@planet.nl> wrote in message news:%2***************@TK2MSFTNGP09.phx.gbl...
Coleen,

Did you already look at this?

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

Maybe it helps easier?

Cor

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: marslee | last post by:
One of the my professor gave final question like this "How to use Access database in .Net enivronment to keep track of data?" I have no idea what it is about since he never taught about .NET in...
1
by: Johann Blake | last post by:
I am looking for a good solution on how to implement data access in an application so that there is a clean separation between the data access layer, the business layer and the GUI layer. I am...
3
by: Michael | last post by:
Does anyone know how to export a data grid from asp.net into microsoft access? Thanks. Michael
11
by: CM Manager via DotNetMonster.com | last post by:
I am very frustrated due to this exception error I am receiving. I've tried searching numerous user support groups, Microsoft Support Net, Google, etc. and haven't found exactly my situation....
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
0
by: upendra | last post by:
Hi, I am B.V.Ramesh Babu.I am working as software programmer using .net.We are using asp.net1.1 with C#.net as coding.I hope that i will get the required support from you. Here is my requirement....
0
by: ashima515 | last post by:
Hi I have made a datagrid whose first col(employee code) is a hyperlink column that redirects the user to another form. I want that when a particular employee code is clicked, the form to which the...
5
nmm32
by: nmm32 | last post by:
I have a DataGrid which displays data with the aid of a procedure. I have tested the procedure inside the database and it is working fine. I have another procedure which adds another row to the...
0
by: cms3023 | last post by:
I have a DataGrid which displays data with the aid of a procedure. I have tested the procedure inside the database and it is working fine. The table inside the database has data that matches with...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.