Buenas al grupo,Estoy intentando personalizar un datagrid siguiendo el
ejemplo del MSDN, pero no refleja los cambios que le indico en el código. Mi
código es el siguiente :
Imports System.Data.SqlClient
Public Class Form1
Inherits System.Windows.Forms.Form
Private ObjCon As SqlConnection
Private ObjAdapter As SqlDataAdapter
Private ObjTable As New DataTable
Private ObjRow As DataRow
#Region " Código generado por el Diseñador de Windows Forms "
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim sSQL As String
Dim mioFuente As New Font("Tahoma", "12", FontStyle.Bold,
GraphicsUnit.Pixel)
ObjCon = New SqlConnection("Data Source = ATREIDES\DATAEUROPA;Integrated
Security=SSPI;database=GRID_1")
ObjCon.Open()
sSQL = "SELECT * FROM Clientes"
ObjAdapter = New SqlDataAdapter(sSQL, ObjCon)
ObjAdapter.Fill(ObjTable)
ObjCon.Close()
grd_clientes.DataSource = ObjTable
grd_clientes.Font = mioFuente
Dim objEstilo As New DataGridTableStyle
objEstilo.MappingName = "Clientes" 'Nombre de mi tabla, comprobado
objEstilo.ForeColor = Color.Black
Dim ObjCol As New DataGridBoolColumn
ObjCol.MappingName = "ID" 'Nombre de mi columna,comprobada
ObjCol.HeaderText = "Identificacion"
objEstilo.GridColumnStyles.Add(ObjCol)
ObjCol = Nothing
End Sub
End Class
Lo he comprobado varias veces y no se que puede estar fallando, pues muestra
la grilla de datos, pero ni me cambia el color "objEstilo.ForeColor Color.Black" en la regilla, ni me cambia el nombre de la columna "ID" por
"Identificacion", ObjCol.HeaderText = "Identificacion".¿Que estoy haciendo
mal?.Gracias por vuestro tiempo
Manu
Leer las respuestas