Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy Grid data from one grid to another.

Status
Not open for further replies.

AFK1

IS-IT--Management
Aug 26, 2005
38
US
I need some help here. I have two grid Parent and child. I have a column in Parent grid called total Qty. What I want to do is on the form load event and Parent grid click event, i want to populate the child grid from the values of parent grid. I need to keep in mind totlal QTY, and divide that Qty by a standard number and show multiple rows in child.
So for one parent I will have coulple of child.
Here is example.
Parent has Total Qty = 60
My standard# = 12
So Total Child Rows = 60/12 = 5 rows in child grid

I need to copy same data 5 times with qty Row like 12,12,12,12,12..
Can someone please help.
 
The type of grid is TDBgrid in vb 6.0.
 
I use the TDBGrid regularly in the Storage data mode. In this mode you can create an array that holds the grid data.
Dim data1 as New XarrayDB

Set gr1.array = data1

Yu can then read any data in your parent and populate your child grid by moving your data from one array to another. You can also add new columns or delete columns as needed (or just hide them). Which version of TDBgrid are you using?
 
I don't know the version of my Grid. Here is what I am trying to do. I have one grid with coupl of columns.
Grid1
VPart VName VQty VPackQty Trialer Shipment
1 Somethn 1000 500 145 1
1 Somethn 1000 500 145 2

When user clicks on the first row. when I populate the second grid I have to use the vQty and VPackQty to determine how many coulmns should be in the second grid.
Like VQty/VPackQty= 1000/500= 2
So i will have two rows with something like taht

VPart VName VQty VPackQty Trialer Shipment
1 Somethn 500 500 145 1
1 Somethn 500 500 145 1

Here is my code

x = 0
lIndex = 0
If Me.grd1.SelBookmarks.Count = 1 Then
vBookmark = (CInt(grd1.SelBookmarks(0)))
Trialer = (array(Trialer_COL, vBookmark))
VPackQty =(array(VPackQty_COL, vBookmark))
VQty= array(VQty_COL, vBookmark)
End If

x = VQty/ VPackQty
For lIndex = 0 To x
ReDim Preserve Array2(lIndex)
Array2(Trialer_COL, lIndex) = Array1(Trialer_COL, vBookmark)
Array1(VName_Col, lIndex) = Array1(VName_Col, vBookmark)
lIndex = lIndex + 1
Next

 
I find this out. I am sending bookmark and sending data from one grid to another.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top