RE:DataGrid con columna passwordchar
Publicado por
kikin (1 intervención) el 26/04/2008 01:16:32
Saludos a todos a lo mejor a les sirve pero encontre la respuesta a mi pregunta
1.- lo mejor es usar un objeto datagridview
'haces la conexion para una base de datos Access
Public Sub ConexionDb()
Dim Conexion As New String("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & StrPath & ";User ID=ADMIN;Persist Security Info=True")
If CN.State = ConnectionState.Open Then CN.Close()
CN.ConnectionString = Conexion
CN.Open()
End Sub
'una funcion para llenar el datagridview
Public Sub llenar(ByVal lista As DataGridView, ByVal Frm As Form, ByVal sql As String)
Dim cmd As OleDbCommand
Dim Lector As OleDbDataReader
Dim ds As New DataSet()
Dim Adaptador As OleDbDataAdapter
ds.Tables.Clear()
Call ConexionDb()
cmd = New OleDbCommand(sql, CN)
Lector = cmd.ExecuteReader
Adaptador = New OleDbDataAdapter(sql, CN)
Adaptador.Fill(ds, sql)
lista.DataSource = ds.Tables(sql)
End Sub
'luego cargas la data en el datagridview
Public Sub Cargando()
Dim sql As String
sql = "SELECT * FROM TABLA"
Call MDI.llenar(Grid1, Me, sql)
End Sub
'Y EN EL EVENTO DEL OBJETO DATAGRIDVIEW cellFormatting
Private Sub Grid1_CellFormatting(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellFormattingEventArgs) Handles Grid1.CellFormatting
'aqui colocas el nombre del campo que necesitas ocultar y listo
If (e.ColumnIndex <> -1 AndAlso Grid1.Columns(e.ColumnIndex).Name = "clave") Then
If (Not e.Value Is Nothing) Then
e.Value = New String("*", e.Value.ToString().Length)
End If
End If
End Sub