zachvaldez
asked on
Replace msflexgrid column content using listview subitem data
How would i replace data in a column in a msflexgrid with a listview subitem.
For example col 5, row1,row2,row 3 with listviews subitem(4) values on each row.
I dont want to commit the numbers yet to the database, just replace
For example col 5, row1,row2,row 3 with listviews subitem(4) values on each row.
I dont want to commit the numbers yet to the database, just replace
ASKER
That is a good start..
However..
How can the row and col be replaced by a variable? Let say we don't know how many rows in that column need to be replace.
for example at col. 5 - there can be 1 or 5 rows.
Can you show me how to loop thru a listview corresponding to filling in the rows of a column in a msflexgrid.
However..
How can the row and col be replaced by a variable? Let say we don't know how many rows in that column need to be replace.
for example at col. 5 - there can be 1 or 5 rows.
Can you show me how to loop thru a listview corresponding to filling in the rows of a column in a msflexgrid.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
HOw about if I want all subitems in a listview going to column 5 of teh grid....which X no of rows/
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
So if there are 2 grid columns from 2 subitems...
please post ur code and specify what u have achieved so far and what u were not able to achieve
ASKER
Error happening: Index out of bounds
Public Sub ReplaceCostPrice()
Dim intLoop As Integer
For intLoop = 0 To lstPrice.ListItems.Count - 1
Insertform.grdEquipData.Te xtMatrix(i ntLoop, 7) = lstPrice.ListItems(intLoop ).SubItems (3) - when it reaches here
Next intLoop
End Sub
Public Sub ReplaceCostPrice()
Dim intLoop As Integer
For intLoop = 0 To lstPrice.ListItems.Count - 1
Insertform.grdEquipData.Te
Next intLoop
End Sub
This means that there is no SubItem 3 in your ListView. Which one are you mentioning 3rd sub item or 4th. It it is 3rd then mention 2 here else 3.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
HI,
I tried to work around with it and I was able to put the values in the grid. the code below
Public Sub ReplaceCostPrice()
Dim intLoop As Integer
Dim litem As ListItem
Dim iRow As Integer
Set Insertform = TopMDIChildForm
For intLoop = 1 To lstPrice.ListItems.Count
For intLoop = 1 To lstPrice.ListItems.Count
Insertform.grdEquipData.Te xtMatrix(i ntLoop, 7) = lstPrice.ListItems(intLoop ).SubItems (2)
Insertform.grdEquipData.Te xtMatrix(i ntLoop, 9) = lstPrice.ListItems(intLoop ).SubItems (3)
Next
intLoop = intLoop + 1
However, it is not hitting the proper row.
I have in my listbox line items 1,2,3,4 in a subitemswhich constitute the rows.
In my grid I also have these line items 1,2,3,4 in a cloumn
I only want to replace the col and row of the line item say/ 2,and 4 . What is happening now is that as I execute it. It replaces the 1st and second rows and not the rows I wanted to. It is not finding the correct row basd on the line item #
How can I find the correct rows thru a loop? thru the array... HOw to compare the rows of listbox and grid based on line item #
I tried to work around with it and I was able to put the values in the grid. the code below
Public Sub ReplaceCostPrice()
Dim intLoop As Integer
Dim litem As ListItem
Dim iRow As Integer
Set Insertform = TopMDIChildForm
For intLoop = 1 To lstPrice.ListItems.Count
For intLoop = 1 To lstPrice.ListItems.Count
Insertform.grdEquipData.Te
Insertform.grdEquipData.Te
Next
intLoop = intLoop + 1
However, it is not hitting the proper row.
I have in my listbox line items 1,2,3,4 in a subitemswhich constitute the rows.
In my grid I also have these line items 1,2,3,4 in a cloumn
I only want to replace the col and row of the line item say/ 2,and 4 . What is happening now is that as I execute it. It replaces the 1st and second rows and not the rows I wanted to. It is not finding the correct row basd on the line item #
How can I find the correct rows thru a loop? thru the array... HOw to compare the rows of listbox and grid based on line item #
MSHFlexgrid1.TextMatrix(1,
MSHFlexgrid1.TextMatrix(2,
MSHFlexgrid1.TextMatrix(3,