473,789 Members | 2,876 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_Cl ick(ByVal sender As System.Object, ByVal e As
System.EventArg s) _
Handles cmdCalculate.Cl ick
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").Ordina l
OrdF = dtMain.Columns( "M").Ordina l

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 1145

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

Similar topics

0
2535
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 dataTable. then, run over all the rows of the dataTable and for each cell in the dataRow concatenate a string (the value in the cell is a string to begin with). I expect the memory to go up every time I load a dataTable, even go up when I modify the...
0
324
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 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
4
1931
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 onmouseover="alert(this.width);"> but I don't want to require any user action.
0
3190
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 text. Before changing to another cell in the DataGrid, I move my mouse pointer off the DataGrid and change the selected item in a ListBox or TreeView. Here's my question Which should fire first, the DataTable's RowChanged/CellChanged event or...
2
1414
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 doesn't get saved to the cell until I hit <Enter> or tab to the next cell. I'd really like to be able to detect each keystroke in the cell, so it would be just like an Excel spreadsheet. I'd settle for the ability to save whatever numbers are in...
3
2893
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 alternative I thought if I can detect double click events on a cell I can get the text in there and do something but I am not able to do so. Please let me know if I have to provide more information to help solve this problem.
1
2974
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 a DataGrid, and set the PrimaryKey of the DataTable to be the first cell in the grid (which is a UserID value). I then store the DataTable in a session object, from which it is retrieved for subsequent pages. All this seems to be working fine. ...
10
4956
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 the column order of the datatable). I also allow the user to click on a column header to sort the datagrid by that column. I need to identify the row and column in the datatable when the user clicks on a cell in the datagrid. Using the...
8
34304
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 my data. (AutoGenerateColumns is true). The data is 2 columns of System.String cell. 4. If I assign the DataTable to DataGridView.DataSource, I get 4 columns. 2
0
950
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 "Insert Row" pops up. The event handler code for when they click on this menu item is as follows: Private Sub Insert_Row(ByVal sender As Object, ByVal e As System.EventArgs) Dim tbl As DataTable = New DataTable
0
9665
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10408
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10199
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6768
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4092
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.