|
-
Jun 6th, 2005, 08:51 AM
#1
Thread Starter
Addicted Member
-
Jun 6th, 2005, 08:56 AM
#2
Thread Starter
Addicted Member
Re: How to hide MSHFlexgrid Subset rows
i can set the column width to 0 but that does not solve my problem. i specifically have to set the height of the child rows to 0. it will be very helpful if anyone give me useful ideas or suggesstions.. thank you.
Kishore...
-
Jun 6th, 2005, 11:55 AM
#3
Re: How to hide MSHFlexgrid Subset rows
You can try this code. It doesn't work if you have shaped the data.
VB Code:
Private Sub cmdExpandCollapse_Click()
Dim i As Integer, r As Integer
' Ignore top row.
r = Me.MSHFlexGrid1.MouseRow
If r < 1 Then Exit Sub
' Find field to collapse or expand.
While r > 0 And Me.MSHFlexGrid1.TextArray(r * Me.MSHFlexGrid1.Cols) = ""
r = r - 1
Wend
' Show collapsed/expanded symbol on first column.
If Me.MSHFlexGrid1.TextArray(r * Me.MSHFlexGrid1.Cols) = "*" Then
Me.MSHFlexGrid1.TextArray(r * Me.MSHFlexGrid1.Cols) = "+"
Else
Me.MSHFlexGrid1.TextArray(r * Me.MSHFlexGrid1.Cols) = "*"
End If
' Expand items under current heading.
r = r + 1
If Me.MSHFlexGrid1.RowHeight(r) = 0 Then
Do While Me.MSHFlexGrid1.TextArray(r * Me.MSHFlexGrid1.Cols) = ""
Me.MSHFlexGrid1.RowHeight(r) = -1 ' Default row height.
r = r + 1
If r >= Me.MSHFlexGrid1.Rows Then Exit Do
Loop
' Collapse items under current heading.
Else
Do While Me.MSHFlexGrid1.TextArray(r * Me.MSHFlexGrid1.Cols) = ""
Me.MSHFlexGrid1.RowHeight(r) = 0 ' Hide row.
r = r + 1
If r >= Me.MSHFlexGrid1.Rows Then Exit Do
Loop
End If
End Sub
-
Jun 6th, 2005, 11:11 PM
#4
Thread Starter
Addicted Member
Re: How to hide MSHFlexgrid Subset rows
hi dglienna,
i am using shape commands only. if you know any way to solve the row hiding problem in shape command itself then please do reply. if there is no way then i should try the other way of directly using select command for each bands. thank you for the suggesstion .
- Kishore...
-
Jun 7th, 2005, 02:00 AM
#5
Re: How to hide MSHFlexgrid Subset rows
 Originally Posted by kishore.kr
hi dglienna,
i am using shape commands only. if you know any way to solve the row hiding problem in shape command itself then please do reply. if there is no way then i should try the other way of directly using select command for each bands. thank you for the suggesstion .
- Kishore...
Hi,
I was trying to achieve a similar thing. But due to time constraint, I shifted over to GridView control. Here is the code that is working till the point you want. It uses the shape command. Just develop it furthur.
On the form it is a MSHGrid named ParentGrid and another named ChildGrid (with index 0).
VB Code:
Option Explicit
Dim con As New ADODB.Connection
Dim rst As New ADODB.Recordset
Private Sub Form_Load()
Dim sCmd As String
' con.CursorLocation = adUseClient
con.Open "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
"C:\Documents and Settings\Administrator\Desktop\Pradeep\TradeNotice" & "\tn.mdb;"
sCmd = "SHAPE {SELECT URL, FriendlyName, tableheaders FROM URL} " & _
"APPEND ({SELECT URL, FriendlyName,tableheaders FROM URL2} AS chapURL " & _
"RELATE tableheaders TO tableheaders )"
rst.StayInSync = False
rst.Open sCmd, con, adOpenStatic, adLockOptimistic
Set ParentGrid.Recordset = rst
ParentGrid.CollapseAll
End Sub
Private Sub Form_Resize()
ParentGrid.Top = 0
ParentGrid.Left = 0
ParentGrid.Width = Me.ScaleWidth
ParentGrid.Height = Me.ScaleHeight
End Sub
Private Sub ParentGrid_Collapse(Cancel As Boolean)
ChildGrid(ParentGrid.Row).Visible = False
End Sub
Private Sub ParentGrid_Expand(Cancel As Boolean)
Dim x As Long
x = ParentGrid.Row
On Error Resume Next
Load ChildGrid(x)
On Error GoTo 0
With ChildGrid(x)
'Set .Recordset = ... '' Fill the child grid
.Move ParentGrid.ColPos(1), ParentGrid.RowPos(x) + ParentGrid.RowHeight(0)
ParentGrid.RowHeight(x) = ChildGrid(x).Height + ParentGrid.RowHeight(0)
.Visible = True
.ZOrder 0
End With
End Sub
Private Sub Form_Unload(Cancel As Integer)
rst.Close
Set rst = Nothing
con.Close
Set con = Nothing
End Sub
-
Jun 14th, 2005, 12:05 AM
#6
Thread Starter
Addicted Member
Re: How to hide MSHFlexgrid Subset rows
hi guys,
thanks for the ideas. i developed my module from your ideas and i got what i required. thanks a lot especially(dglienna, pradeep).. i have planned to develop it further and make an ocx(in future..).
-- Kishore...
-
Apr 16th, 2008, 05:54 PM
#7
New Member
Re: How to hide MSHFlexgrid Subset rows[Resolved]
Iam facing the grouping problem and tried your code have error in executing
'Invalid Sql Statment expected insert,delete,select or update'
if you please provide an example or write more details
Thanks
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
|