|
-
Sep 13th, 2005, 02:31 PM
#1
Thread Starter
Addicted Member
tablestyle
When I call formatogrid, it doesn`t work, can anybody give a hand on that
plz
thnx
VB Code:
Dim mitb As New DataTable("Registros")
Private Sub frmConsultaDetalle_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LlenaLista(cboEstado, "Estado")
mitb = objTQueja.DevuelveQuejasEstado("PENDIENTE")
dtgQuejas.DataSource = mitb
formatogrid()
End Sub
Sub formatogrid()
With dtgQuejas
.BackColor = Color.GhostWhite
.BackgroundColor = Color.GhostWhite
.BorderStyle = BorderStyle.None
.CaptionBackColor = Color.FloralWhite
.CaptionFont = New Font("Tahoma", 10.0!, FontStyle.Bold)
.CaptionForeColor = Color.Black
.CaptionText = "Registros de Quejas"
.Font = New Font("Tahoma", 8.0!)
.ParentRowsBackColor = Color.Beige
.ParentRowsForeColor = Color.MidnightBlue
End With
Dim miestilo As New DataGridTableStyle
With miestilo
.AlternatingBackColor = Color.GhostWhite
.BackColor = Color.GhostWhite
.ForeColor = Color.MidnightBlue
.GridLineColor = Color.RoyalBlue
.HeaderFont = New Font("Tahoma", 8.0!, FontStyle.Bold)
.SelectionBackColor = Color.OldLace
.SelectionForeColor = Color.Blue
.MappingName = "Registros"
End With
Dim grdColStyle1 As New DataGridTextBoxColumn
With grdColStyle1
.HeaderText = "Código"
.MappingName = "reclamoID"
.ReadOnly = True
.Width = 30
End With
Dim grdColStyle2 As New DataGridTextBoxColumn
With grdColStyle2
.HeaderText = "Fecha Registro"
.MappingName = "fecRegistro"
.ReadOnly = True
.Width = 50
End With
miestilo.GridColumnStyles.AddRange(New DataGridColumnStyle() {grdColStyle1})
dtgQuejas.TableStyles.Add(miestilo)
End Sub
-
Sep 13th, 2005, 03:02 PM
#2
Frenzied Member
Re: tablestyle
Other that it needs to translated into English, it looks pretty good. Here is an example of code i use:
VB Code:
Dim grdColStyle2 As New DataGridTextBoxColumn
With grdColStyle2
.HeaderText = "File ID"
.MappingName = "FileID"
End With
Dim grdColStyle3 As New DataGridTextBoxColumn
With grdColStyle3
.HeaderText = "DL Date"
.MappingName = "WhenDL"
.Width = 75
.ReadOnly = True
End With
Dim grdTableStyle1 As New DataGridTableStyle
With grdTableStyle1
.AlternatingBackColor = Color.GhostWhite
.BackColor = Color.GhostWhite
.ForeColor = Color.MidnightBlue
.GridLineColor = Color.RoyalBlue
.HeaderBackColor = Color.MidnightBlue
.HeaderFont = New Font("Tahoma", 8.0!, FontStyle.Bold)
.HeaderForeColor = Color.Lavender
.SelectionBackColor = Color.Teal
.SelectionForeColor = Color.PaleGreen
'LOOK: Do not forget to set the MappingName property. Without this, the DataGridTableStyle properties
'and any associated DataGridColumnStyle objects will have no effect.
.MappingName = DS_ENTRY
.PreferredColumnWidth = 125
.PreferredRowHeight = 15
End With
grdTableStyle1.GridColumnStyles.AddRange(New DataGridColumnStyle() {grdColStyle1, grdColStyle2, grdColStyle3})
DataGrid1.TableStyles.Add(grdTableStyle1)
~Peter

-
Sep 13th, 2005, 08:10 PM
#3
Re: tablestyle
 Originally Posted by silverup
When I call formatogrid, it doesn`t work, can anybody give a hand on that
plz
thnx
VB Code:
Dim mitb As New DataTable("Registros")
Private Sub frmConsultaDetalle_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
LlenaLista(cboEstado, "Estado")
mitb = objTQueja.DevuelveQuejasEstado("PENDIENTE")
dtgQuejas.DataSource = mitb
formatogrid()
End Sub
Sub formatogrid()
With dtgQuejas
.BackColor = Color.GhostWhite
.BackgroundColor = Color.GhostWhite
.BorderStyle = BorderStyle.None
.CaptionBackColor = Color.FloralWhite
.CaptionFont = New Font("Tahoma", 10.0!, FontStyle.Bold)
.CaptionForeColor = Color.Black
.CaptionText = "Registros de Quejas"
.Font = New Font("Tahoma", 8.0!)
.ParentRowsBackColor = Color.Beige
.ParentRowsForeColor = Color.MidnightBlue
End With
Dim miestilo As New DataGridTableStyle
With miestilo
.AlternatingBackColor = Color.GhostWhite
.BackColor = Color.GhostWhite
.ForeColor = Color.MidnightBlue
.GridLineColor = Color.RoyalBlue
.HeaderFont = New Font("Tahoma", 8.0!, FontStyle.Bold)
.SelectionBackColor = Color.OldLace
.SelectionForeColor = Color.Blue
.MappingName = "Registros"
End With
Dim grdColStyle1 As New DataGridTextBoxColumn
With grdColStyle1
.HeaderText = "Código"
.MappingName = "reclamoID"
.ReadOnly = True
.Width = 30
End With
Dim grdColStyle2 As New DataGridTextBoxColumn
With grdColStyle2
.HeaderText = "Fecha Registro"
.MappingName = "fecRegistro"
.ReadOnly = True
.Width = 50
End With
miestilo.GridColumnStyles.AddRange(New DataGridColumnStyle() {grdColStyle1})
dtgQuejas.TableStyles.Add(miestilo)
End Sub
Be sure that the string you provide in mappingname should be the same column name of your datatable and you didn't add the second datagridtextboxcolumn(grdColStyle2)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|