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 MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have a Hierarchical FlexGrid the

Status
Not open for further replies.

ii128

Programmer
May 18, 2001
129
US
I have a Hierarchical FlexGrid the layout as follow:


Company ID Company Name Department Employee Name
1 BB. Inc HR Lucy
Danny
IS Candy
Daicy
2 ABC. Inc HR Steve
Fanny
IS Nancy


Any one can help me That?

when I click on cell of "BB. Inc.", how can I get the value of that cell(BB. Inc.) and the Company ID(1). When I click on one of the employee Name cell like "Lucy", How can I get the value of that cell("Lucy") and the Company ID(1)?
 
value = flexgrid.textmatrix(flexrid.row,flexgrid.col)
 
75cl,

When I click on Danny, your code can find the value of Company_ID("1")
 
Assuming the "Company ID" is in column 1 and
your grid is named grdData:

Private Sub grdData_Click()
Dim nRow As Long
Dim nCol As Long
Dim sCellValue As String
Dim sCompanyId As String
Dim i As Long

With grdData
nRow = .Row
nCol = .Col

sCellValue = .TextMatrix(nRow, nCol)
sCompanyId = .TextMatrix(nRow, 1)

If sCompanyId = "" Then
For i = nRow - 1 To 1
sCompanyId = .TextMatrix(i, 1)
If sCompanyId <> &quot;&quot; Then Exit For
Next i
End If
End With
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top