|
-
Apr 19th, 2007, 01:37 PM
#1
Thread Starter
New Member
double click ?grid
Hi all,
this is what im trying to do, i have a grid in this case i have a msflexgrid. when the user clicks on a row then double clicks on the same row, i want that row to display in a second msflexgrid or list, or listview, or mshflexgrid
as far as code this is what i have so far
Dim rowIndex As Integer
Dim colIndex As Integer
ListView1.ListItems.Clear
rowIndex = MSFlexGrid1.Row
For colIndex = 1 To MSFlexGrid1.Cols - 1
If colIndex = 1 Then
ListView1.ListItems.Add , , MSFlexGrid1.TextMatrix(rowIndex, colIndex)
Else
ListView1.ListItems.Add , , MSFlexGrid1.TextMatrix(rowIndex, colIndex)
End If
Next colIndex
this one is from msflexgrid to listview, but it will display the info column wise. i want the info to show row wise
lastname firstname address
doe
john
123 noname ave
somwhere
this is the way is being display. am i missing something in the code. can anyone help me with this headache. I appreciate any help
thank you very much
m.e. again
-
Apr 20th, 2007, 05:10 AM
#2
Re: double click ?grid
 Originally Posted by martino
Hi all,
this is what im trying to do, i have a grid in this case i have a msflexgrid. when the user clicks on a row then double clicks on the same row, i want that row to display in a second msflexgrid or list, or listview, or mshflexgrid
as far as code this is what i have so far
Dim rowIndex As Integer
Dim colIndex As Integer
ListView1.ListItems.Clear
rowIndex = MSFlexGrid1.Row
For colIndex = 1 To MSFlexGrid1.Cols - 1
If colIndex = 1 Then
ListView1.ListItems.Add , , MSFlexGrid1.TextMatrix(rowIndex, colIndex)
Else
ListView1.ListItems.Add , , MSFlexGrid1.TextMatrix(rowIndex, colIndex)
End If
Next colIndex
this one is from msflexgrid to listview, but it will display the info column wise. i want the info to show row wise
lastname firstname address
doe
john
123 noname ave
somwhere
this is the way is being display. am i missing something in the code. can anyone help me with this headache. I appreciate any help
thank you very much
m.e. again
There may be other ways but what I do is:
Dim iItem As ListItem
'Load your first column
set item = ListView1.ListItems.Add , , MSFlexGrid1.TextMatrix(rowIndex, colIndex)
'Then add your sub items in a loop incrementing "i" below and your rows and columns.
iItem.SubItems(i) = MSFlexGrid1.TextMatrix(rowIndex, colIndex)
-
Apr 23rd, 2007, 01:59 PM
#3
Thread Starter
New Member
Re: double click ?grid
thank you for your response.
this is the code now:
Dim itmx As ListItem
Dim I As Integer
Set itmx = ListView1.ListItems.Add(, , MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 1))
itmx.SubItems(1) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 2)
itmx.SubItems(2) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 3)
itmx.SubItems(3) = MSFlexGrid1.TextMatrix(MSFlexGrid1.Row, 4)
thaks again. any ideas how to do it from msflexgrid to msflexgrid on double click.
thank you
m.e.
-
Apr 23rd, 2007, 02:37 PM
#4
Re: double click ?grid
This will copy the whole double-clicked-on row from MSFlexGrid1 to the current row in MSFlexGrid2
Code:
Private Sub MSFlexGrid1_DblClick()
'set the row in MSFlexgrid2 that's going to get the data here
'or maintain it somewhere else in the program
Dim i As Integer
With MSFlexGrid1
For i = 0 To .Cols - 1
MSFlexGrid2.TextMatrix(MSFlexGrid2.Row, i) = .TextMatrix(.MouseRow, i)
Next i
End With
End Sub
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Apr 23rd, 2007, 05:03 PM
#5
Thread Starter
New Member
Re: double click ?grid
hi
i get "subscript out of range". did i do anything wrong. im using two msflexgrid(msflexgrid1 and msflexgrid2). any changes required to any of the grids?
thank for the quick response
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
|