|
-
Mar 31st, 2001, 08:44 PM
#1
Thread Starter
Member
Ok, I have been trying to create a column in a DBGrid control that gets the total of tickets sold * price.
The datagrid is tied to this select statement:
Select Outlet, Price, Sold From Tickets Where ....
Set grdTickets.DataSource.....
I get this to bind just fine
I then add another column:
grdTickets.Columns.Add (.Cloumns.Count)
This adds another column just fine.
Now I want to iterate through the existing rows and get a total for Price * Sold (cols 1 & 2) and place it into the totals column( col 3).
As of now, there are no more than 7 rows at any time...this may change in the future.
So...
For i = 0 to (grdTickets.ApproxCount - 1)
'Here is where I am having trouble accessing cells
'For each row in the grid, multiply the Price column (1)
'by the sold column(2) and place that amount into the
'total column(3).
Next
Any suggestions appreciated, especially ones that could do it more elegantly 
After some experimenting, this still does not work:
For i = 0 To (.ApproxCount - 1)
.Columns(3).CellValue(.RowBookmark(i)) = .Columns(1).CellValue(.RowBookmark(i)) * .Columns(2).CellValue(.RowBookmark(i))
Next
I get an object required error.
However, the assignment after the = is correct (I tried it with a array of text boxes. So now my question is how do I access the empty cell?
Last edited by kurtzilla; Mar 31st, 2001 at 09:09 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|