473,387 Members | 1,603 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,387 software developers and data experts.

DATATABLE problem retrieving the value of a cell

I have a datatable of values and I am trying to obtain the values of a range
of the columns.

Imagine I have a table defined with columns headed "A" through to "Z"

Now I decide that I want to count up the amounts between columns E to M
Note:All the columns are defined as decimal.
I have a main datatable defined at dtMain with all the columns and data in
it.
The code I am using at the moment is:

Private Sub cmdCalculate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) _
Handles cmdCalculate.Click
Dim dr As DataRow
Dim OrdS As Integer
Dim OrdF As Integer

'find the ordinal start and end for the addition
OrdS = dtMain.Columns("E").Ordinal
OrdF = dtMain.Columns("M").Ordinal

For Each dr In dtMain.Rows
Debug.WriteLine("----------------------------------------")
Dim sumcol As Decimal

For i = OrdS To OrdF
Debug.WriteLine(dtMain.Columns(i).Caption & " - " &
dtMain.Columns(i).ToString()) 'I KNOW THIS IS WRONG

'sumcol =sumcol + [????????????????????????]

Next
debug.writeline(sumcol)
Next

End Sub

please can anyone advise how I can obtain the contents of the cell in the
dtmain table so that I can achieve a calculation.

Thanks in advance

Terry

Nov 22 '05 #1
0 1114

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

Similar topics

0
by: dudi | last post by:
I am encountering the following strange problem which causes the application to use more memory then it should. I have 5 database tables. lets pretend I want to load each one of them into a...
0
by: anon | last post by:
I have a datatable of values and I am trying to obtain the values of a range of the columns. Imagine I have a table defined with columns headed "A" through to "Z" Now I decide that I want to...
4
by: Lan Vuong | last post by:
Hi everyone, I'm trying to retrieve the width of a cell as the table is being dynamically created and add it to a total. I can get the width from an eventhandler such as: <td...
0
by: Emerson | last post by:
The following assumes a System.Windows.Forms.DataGrid with a System.Data.DataTable set as the DataSource. I'm programming in C# Here's my scenario I click in a cell on a DataGrid. I enter some...
2
by: Randy | last post by:
I have a DataTable in a DataGrid on a Windows form. I have comboboxes in the first column, and that seems to work just fine. The second column is for a money amount. The numeric dollar value...
3
by: Maulin Vasavada | last post by:
Hi, I have DataTable and I want to actually put a LinkLabel in one the columns where I can click an do something BUT it seems I can't put LinkLabel in the table cell of DataTable. So as an...
1
by: Mike | last post by:
I have an ASP.NET/VB app that updates values in a DataTable over the course of about 3 different pages. On the way out of the first of these pages, I explicitly build the DataTable from values in...
10
by: JohnR | last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a datagridtablestyle defined. I use the datagridtablestyle to change the order of the columns (so they can be different than...
8
by: George | last post by:
Hi, I have been trying to see if I can do the following: 1. Create a DataGridView 2. Create 2 columns in the DataGridView (1 textbox and the other combobox) 3. Create a DataTable containing...
0
by: simchajoy2000 | last post by:
Hi, I am experiencing a strange problem when inserting rows in a datatable that is attached to a datagrid. I have made it so that when the user right clicks on a row the context menu item...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.