Hola Foro, necesito su ayuda
Al aplicarle estilo a un datagrid, éste pierde la función de la barra de desplazamiento vertical (siempre que las filas en el datatable sobrepasan el espacio visible del grid). El estilo aplicado, solo configura las columnas y su ancho
Ver código
Sub Configura_DTMateriales(
Dim dataAdapter As New OleDb.OleDbDataAdapte
Dim miCmd As New System.Data.OleDb.OleDbComman
'dsAsigna = New DataSe
'dtAsigna = New DataTabl
Dim miDataSet As New DataSe
Dim sqlString As Strin
'Declarar y añadir columna ARTICUL
Dim colARTICULO As DataColumn = MIdt.Columns.Add("ARTICULO", GetType(System.Int32)
colARTICULO.AllowDBNull = Fals
colARTICULO.ReadOnly = Tru
colARTICULO.Unique = Tru
'Declarar y añadir columna DESCRIPCIO
Dim colDESCRIPCION As DataColumn = MIdt.Columns.Add("DESCRIPCION", GetType(System.String)
colDESCRIPCION.AllowDBNull = Fals
colDESCRIPCION.ReadOnly = Tru
'Declarar y añadir columna CANTIDA
Dim colCANTIDAD As DataColumn = MIdt.Columns.Add("CANTIDAD", GetType(System.Int32)
colCANTIDAD.AllowDBNull = Fals
colCANTIDAD.ReadOnly = Fals
colCANTIDAD.DataType = System.Type.GetType("System.Int32"
colCANTIDAD.DefaultValue =
''Asignar Llave primaria al Datatable. En este caso la columna ARTICUL
MIdt.PrimaryKey = New DataColumn()
{MIdt.Columns("ARTICULO")
'MIdt.DefaultView.AllowEdit = Fals
MIdt.DefaultView.AllowNew = Fals
Dim tableStyle As New DataGridTableStyl
tableStyle.MappingName = MIdt.TableNam
Dim i As Intege
While i < MIdt.Columns.Coun
'Campos representados en TextBox (ARTICULO, DESCRIPCION, CANTIDAD
Dim TextCol As New DataGridTextBoxColum
TextCol.MappingName = MIdt.Columns(i).ColumnNam
TextCol.HeaderText = MIdt.Columns(i).ColumnNam
Select Case
Case
'Col. ARTICUL
TextCol.ReadOnly = Tru
'TextCol.Width = 1
Case
'Col. DESCRIPCIO
TextCol.ReadOnly = Tru
TextCol.Width = 36
TextCol.ReadOnly = Tru
Case
'Col. CANTIDA
TextCol.ReadOnly = Fals
TextCol.TextBox.Enabled = Tru
TextCol.ReadOnly = Fals
TextCol.NullText =
End Selec
tableStyle.GridColumnStyles.Add(TextCol
i = i +
End Whil
DataGrid1.TableStyles.Clear(
DataGrid1.TableStyles.Add(tableStyle
DataGrid1.DataSource = MId
DataGrid1.Refresh(
End Su
jmrivera
Ver este tema:
http://www.softwaremix.net/viewtopic-445650.htm
Enviado desde
http://www.softwaremix.net
Leer las respuestas