![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
19/07/2012, 14:45
|
| | Fecha de Ingreso: julio-2012 Ubicación: Avellaneda
Mensajes: 3
Antigüedad: 12 años, 6 meses Puntos: 0 | |
Respuesta: Problema datagridview Se siguen mostrando las filas no entiendo porque no lo hace, a ver si pueden sacar cual es el error, que estoy cometiendo.
Les mando el codigo completo de la clase del formulario
Public Class FrmListado
Private _bSourceDelListado As BindingSource
'Private _dataViewManagerDelListado As DataViewManager
Private _dataSetDelListado As DataSet
Private _TipoDeListado As String
Public Sub New(ByVal TipoDeListado As String)
' Llamada necesaria para el Diseñador de Windows Forms.
InitializeComponent()
Me._TipoDeListado = TipoDeListado
' Agregue cualquier inicialización después de la llamada a InitializeComponent().
End Sub
Private Sub FrmListado_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Icon = My.Resources.ÍconoAcp
Me._dataSetDelListado = _delegadoTDS.Invoke()
Me._bSourceDelListado = New BindingSource
Me._bSourceDelListado.DataSource = Me._dataSetDelListado
Me._bSourceDelListado.DataMember = "Empleado"
Me.dgvListado.DataSource = Me._bSourceDelListado
Call ConfigurarDGView()
End Sub
Public Sub ConfigurarDGView()
dgvListado.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill
dgvListado.EnableHeadersVisualStyles = True
REM seteo el formato del encabezado
dgvListado.RowHeadersDefaultCellStyle.BackColor = Color.Aqua
dgvListado.RowHeadersDefaultCellStyle.ForeColor = Color.Lavender
dgvListado.RowHeadersVisible = False
dgvListado.ColumnHeadersVisible = True
REM doy formato a las filas
dgvListado.RowsDefaultCellStyle.BackColor = Color.MediumSeaGreen
dgvListado.RowsDefaultCellStyle.ForeColor = Color.GhostWhite
With dgvListado
.SelectionMode = DataGridViewSelectionMode.FullRowSelect
.EditMode = DataGridViewEditMode.EditProgrammatically
.AllowUserToAddRows = False
.AllowUserToDeleteRows = True
.AllowUserToResizeColumns = True
.AllowUserToResizeRows = True
.Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Right
.BackgroundColor = Color.DarkGray
.BorderStyle = BorderStyle.Fixed3D
.CellBorderStyle = DataGridViewCellBorderStyle.Sunken
.ColumnHeadersBorderStyle = DataGridViewHeaderBorderStyle.Sunken
.ColumnHeadersDefaultCellStyle.BackColor = Color.Azure
.DefaultCellStyle.BackColor = Color.Cyan
End With
dgvListado.ColumnHeadersDefaultCellStyle.BackColor = Color.Black
dgvListado.ColumnHeadersDefaultCellStyle.ForeColor = Color.White
dgvListado.GridColor = Color.Red
For i As Integer = 0 To Me.dgvListado.Columns.Count - 1
If Not i = 0 And Not i = 1 And Not i = 12 Then
Me.dgvListado.Columns(i).Visible = False
End If
Next
If Me._TipoDeListado = "Alta" Then
Dim cm As CurrencyManager = DirectCast(BindingContext(Me.dgvListado.DataSource ), CurrencyManager)
For i As Integer = 0 To Me._dataSetDelListado.Tables("Empleado").Rows.Coun t - 1
If CBool(Me._dataSetDelListado.Tables("Empleado").Row s(i)("Alta").ToString) = True Then
If i = 0 Then
Me.dgvListado.CurrentCell = Nothing
'Me.dgvListado.Rows(i).Visible = False
'Para poder ocultarla, primero tienes que romper el enlace que existe entre tu Datagridview y el DataSource
'Haz lo siguiente al momento de querer ocultar la fila:
cm.SuspendBinding()
Me.dgvListado.Rows(i).Visible = False
cm.ResumeBinding()
Else
cm.SuspendBinding()
Me.dgvListado.Rows(i).Visible = False
cm.ResumeBinding()
End If
End If
Next
End If
end class |