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

VB.NET DataGrid Record Loop Help

40
Basically what I'm trying to do is - subtract a time field in my record from my system time for each record. Business Days Only
example

order NO__Name ___Req_date ___Days late (Dynamic Column for Calc Results)
11111_____ Test ___8/17/2007 ________4
11112_____ Test2 ___8/15/2007 _______6

Days Late is a dynamic column
I need to do this for each record - and I can not get my loop to work - when it loops it I only get the calculation for the first record and it puts that calculation in every record for days late

This is my Code - What am I missing? How do I get it to go to next record - I've changed the code around so much - that nothing makes sense any more - Help will be appreciated
Expand|Select|Wrap|Line Numbers
  1. Dim dt1 As New DataTable            
  2. Dim rw As DataRow
  3.  
  4.             dt1 = MyDataSet.Tables(0)
  5.  
  6.             For Each rw In dt1.Rows
  7.                 '  Console.WriteLine(rw("Days Late"))
  8.                 Select Case DatePart("w", d1)
  9.                     Case 1
  10.                         subtract = subtract + 1
  11.                     Case 7  
  12.                         subtract = subtract + 2
  13.                 End Select
  14.  
  15.                 Select Case DatePart("w", d2)
  16.                     Case 1
  17.                         subtract = subtract + 2
  18.                     Case 7
  19.                         subtract = subtract + 1
  20.                 End Select
  21.  
  22.                 absday = DateDiff("d", d1, d2) + 1 - subtract
  23.  
  24.                 fncGetDays = absday - CInt(2 * (absday \ 7))
  25.  
  26.                 If fncGetDays < 0 Then fncGetDays = 0
  27.  
  28.             Next rw
  29.  
Aug 23 '07 #1
0 1254

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: JingleBEV | last post by:
Hi all, I don't seem to get this going, possibly lacking the knowledge of dao recordset. I try to fill this Datagrid with the DAO.recordset, but it keeps giving me the error 13 - datatype...
3
by: DC | last post by:
Dear ASP.Net Experts, In ASP, I can write something like this: <table> <tr> <th align=left>ID</th> <th align=left>Product Name</th> <th align=left>Price</th> </tr> <%
10
by: Jennyfer J Barco | last post by:
Hello, I have a datagrid that brings some information from a query. I need to have a checkbox in each row so the user can select the rows he wants to reprint. Is it possible to have a checkbox...
3
by: rodchar | last post by:
hey all, i was wondering if you knew a particular row id in a datagrid (which shows 10 records at a time) that you wanted to look at is there a way to position to the current page index for...
3
by: tjonsek | last post by:
I am using a Datagrid to display a list of names associated with a record in a database. I am now creating an email capability that would allow the user to email basic details about the record and...
0
by: Nathan Franklin | last post by:
Hello Guys, I have been trying to work this our for so long, but I just can't seem to find the answer. I am loading a datatable from a an access database using an oledbdataadapter. I then...
1
by: johnlim20088 | last post by:
Hi Hi, can anyone help me on loop datagrid item in datagrid1_ItemDataBound? My datagrid have 3 column to display for data for each row, i will check the second column value, to determine the...
2
daniel aristidou
by: daniel aristidou | last post by:
Hi can anyone help me with the logic of updating records that are selected in a datagrid. Just wanna be sure before i code it all, since its first time im doing this and making sure the logic is...
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?
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
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,...
0
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...
0
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...

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.