Ver Mensaje Individual
  #1 (permalink)  
Antiguo 05/03/2010, 12:01
fiorella3247
 
Fecha de Ingreso: febrero-2009
Mensajes: 101
Antigüedad: 15 años, 2 meses
Puntos: 0
TreeView en VB 6.0

Hola Compañeros!!!

Resulta que hago una consulta en un TreeView y aplico la propiedad expanded... para expandir el nodo del TreeView que tiene datos de la siguiente manera:

Código vb:
Ver original
  1. With TreeView
  2.     .Nodes.Clear
  3.         .Nodes.Add , , "Paciente", "Paciente"
  4.         .Nodes.Add , , "Fertilidad", "Fertilidad"
  5.             cmd2.CommandText = "select historia,fecha from fertilidad where historia ='" & numhis & "'"
  6.             Set rst = cmd2.Execute
  7.             If rst.RecordCount > 0 Then
  8.                 For X = 1 To rst.RecordCount
  9.                     .Nodes.Add "Fertilidad", tvwChild, , rst.Fields(1).Value
  10.                     .Nodes(X).Expanded = True
  11.                     rst.MoveNext
  12.                 Next X
  13.             End If
  14.         .Nodes.Add , , "Ginecologia", "Ginecologia"
  15.             cmd2.CommandText = "select historia,fecha from ginecologia where historia ='" & numhis & "'"
  16.             Set rst = cmd2.Execute
  17.             If rst.RecordCount > 0 Then
  18.                 For X = 1 To rst.RecordCount
  19.                     .Nodes.Add "Ginecologia", tvwChild, , rst.Fields(1).Value
  20.                     .Nodes(X).Expanded = True
  21.                     rst.MoveNext
  22.                 Next X
  23.             End If
  24.         .Nodes.Add , , "Obstetricia", "Obstetricia"
  25.             cmd2.CommandText = "select historia,fecha from obstetricia where historia ='" & numhis & "'"
  26.             Set rst = cmd2.Execute
  27.             If rst.RecordCount > 0 Then
  28.                 For X = 1 To rst.RecordCount
  29.                     .Nodes.Add "Obstetricia", tvwChild, , rst.Fields(1).Value
  30.                     .Nodes(X).Expanded = True
  31.                     rst.MoveNext
  32.                 Next X
  33.             End If
  34.         .Nodes.Add , , "Urologia", "Urologia"
  35.             cmd2.CommandText = "select historia,fecha from urologia where historia ='" & numhis & "'"
  36.             Set rst = cmd2.Execute
  37.             If rst.RecordCount > 0 Then
  38.                 For X = 1 To rst.RecordCount
  39.                     .Nodes.Add "Urologia", tvwChild, , rst.Fields(1).Value
  40.                     .Nodes(X).Expanded = True
  41.                     rst.MoveNext
  42.                 Next X
  43.             End If
  44.         .Nodes.Add , , "Laboratorios", "Laboratorios"
  45.            
  46. '             where CI='" & cedulai & "' or CI='" & Format(cedulai, "#") & "'"
  47.            If cedulai <> "" Then
  48.                 cmd3.CommandText = "SELECT Examenes.Fecha" _
  49.                                     & " FROM Examenes INNER JOIN Paciente ON Examenes.IdPaciente = Paciente.IdPaciente INNER JOIN ItemSeccion ON Examenes.IdExamen = ItemSeccion.IdExamen" _
  50.                                     & " WHERE (Examenes.Resultado IS NOT NULL) and (CI='" & cedulai & "' or CI='" & Format(cedulai, "#") & "') group by Examenes.fecha "
  51.                 Set rst = cmd3.Execute
  52.                 If rst.RecordCount > 0 Then
  53.                     For X = 1 To rst.RecordCount
  54.                         .Nodes.Add "Laboratorios", tvwChild, , rst.Fields(0).Value
  55.                         .Nodes(X).Expanded = True
  56.                         rst.MoveNext
  57.                     Next X
  58.                 End If
  59.             End If
  60.     End With
  61. End Sub

Pero en ocasiones... el nodo no abre a pesar de que tiene datos... Alguien tiene una respuesta para esta situación...

Muchas Gracias por leerme y full éxito
__________________
Fiorellita