Tema: FAQ's de VB6
Ver Mensaje Individual
  #23 (permalink)  
Antiguo 04/09/2004, 20:00
Avatar de GeoAvila
GeoAvila
Colaborador
 
Fecha de Ingreso: diciembre-2003
Ubicación: Antigua Guatemala
Mensajes: 4.032
Antigüedad: 20 años, 4 meses
Puntos: 53
Grid Editable 4

Código:
 Private Sub OcultarControles()

	' Ocultar los controles de edición							  (17/May/01)

	' (aunque son pocos, se pueden ampliar y así es más fácil saber dónde

	' poner el código para ocultarlos)

	Text1.Visible = False

	Combo1.Visible = False

End Sub



Private Sub LeerDatos()

	' Leer los datos y asignarlos al grid

	Dim nFic As Long

	Dim r As Long

	Dim c As Long

	Dim s As String

	'

	' Si no existe el fichero, nada que hacer...

	If Len(Dir$(sFicDatos)) = 0 Then Exit Sub

	'

	r = Grid2.Rows - 2

	nFic = FreeFile

	Open sFicDatos For Input As nFic

	Do While Not EOF(nFic)

		r = r + 1

		Grid2.Rows = r + 2

		Grid2.TextMatrix(r, 0) = r

		For c = 1 To Grid2.Cols - 1

			If Not EOF(nFic) Then

				Line Input #nFic, s

				Grid2.TextMatrix(r, c) = s

			Else

				Exit For

			End If

		Next

	Loop

	Close nFic

	'

	With Grid2

		.TextMatrix(.Rows - 1, 0) = cNuevaFila

		LastRow = .Rows - 1

		LastCol = 1

		.Col = LastCol

		.Row = LastRow

		.RowSel = LastRow

		.ColSel = LastCol

	End With

End Sub



Private Sub GuardarDatos()

	' Guardar los datos del Grid

	Dim nFic As Long

	Dim r As Long

	Dim c As Long

	'

	nFic = FreeFile

	Open sFicDatos For Output As nFic

	' No guardar la última fila, (si se usa el indicador de nueva fila)

	For r = 1 To Grid2.Rows - 2

		For c = 1 To Grid2.Cols - 1

			Print #nFic, Grid2.TextMatrix(r, c)

		Next

	Next

	Close nFic

End Sub 
__________________
* Antes de preguntar lee las FAQ, y por favor no hagas preguntas en las FAQ
Sitio http://www.geoavila.com twitter: @GeoAvila