G
Guest
Hello
I need somebody’s help with the following
I tried to display data to a DataGrid, that is not the problem
But if I try to add a TableStyle to a DataGrid then I don’t get a result ( no data)
If I use the next code, but without a TableStyle, it works
----------------------------------------------------------------------------------------------------------------
'Declaratie
Dim strMedewerker As Strin
'Set de standaard medewerker in de strMedewerker strin
strMedewerker = "Marco Di Gregorio
'Alle velden leegmake
If DataGridWijziging.Text >= "" The
txtBeginDatum.Text = "
txtEindDatum.Text = "
objDsDGWijziging.Tables.Clear(
DataGridWijziging.DataSource = Nothin
End I
'Datagrid vernieuwe
DataGridWijziging.Refresh(
If txtEindDatum.Text = "" And txtBeginDatum.Text = "" The
'Set de geselecteerd datum in de txtBeginDatum en txtEindDatu
txtBeginDatum.Text = WijzigingsKalender.SelectionStar
txtEindDatum.Text = WijzigingsKalender.SelectionEn
Els
End I
'Connectie make
Dim objConn As OleDb.OleDbConnection = Connectie(
'OleDbCommand voor het uitvoeren van de SQL script aanmake
Dim cmd As New OleDbCommand("SELECT Activiteitomschrijving, Medewerker, Datum, Uren FROM Query_InvoerUren WHERE Medewerker ='" & strMedewerker & "' AND Datum BETWEEN @beginDatum And @EindDatum", objConn
cmd.Parameters.Add("@BeginDatum", CDate(txtBeginDatum.Text)
cmd.Parameters.Add("@EindDatum", CDate(txtEindDatum.Text)
Dim objADaDGWijziging As New OleDbDataAdapter(cmd
'objDatasetDataGridWijziging vulle
objADaDGWijziging.Fill(objDsDGWijziging
'DataGrid vulle
'DataGridWijziging.PreferredColumnWidth = 15
DataGridWijziging.DataSource = objDsDGWijziging.Tables(0
----------------------------------------------------------------------------------------------------------------
If I add the next code then I won’t get my result
----------------------------------------------------------------------------------------------------------------
Dim DaGridTableStyle As New DataGridTableStyl
With DaGridTableStyl
.AlternatingBackColor = Color.GhostWhit
.BackColor = Color.GhostWhit
.ForeColor = Color.MidnightBlu
.GridLineColor = Color.RoyalBlu
.HeaderBackColor = Color.MidnightBlu
.HeaderFont = New Font("Tahoma", 8.0!, FontStyle.Bold
.HeaderForeColor = Color.Lavende
.SelectionBackColor = Color.Tea
.SelectionForeColor = Color.PaleGree
.MappingName = "Query_InvoerUren
.PreferredRowHeight = 1
End Wit
Dim DataGridColStyle1 As New DataGridTextBoxColum
With DataGridColStyle
.HeaderText = "Medewerker
.MappingName = "Medewerker
.Width = 4
.ReadOnly = Tru
End Wit
Dim DataGridColStyle2 As New DataGridTextBoxColum
With DataGridColStyle
.HeaderText = "Activiteitomschrijving
.MappingName = "Activiteitomschrijving
.Width = 15
.ReadOnly = Tru
End Wit
Dim DataGridColStyle3 As New DataGridTextBoxColum
With DataGridColStyle
.HeaderText = "Datum
.MappingName = "Datum
.Width = 2
.ReadOnly = Tru
End Wit
Dim DataGridColStyle4 As New DataGridTextBoxColum
With DataGridColStyle
.HeaderText = "Uren
.MappingName = "Uren
.Width = 1
.ReadOnly = Fals
End Wit
' Add the style objects to the table style's collection of
' column styles. Without this the styles do not take effect.
DaGridTableStyle.GridColumnStyles.AddRange
(New DataGridColumnStyle()
{DataGridColStyle1, DataGridColStyle2, DataGridColStyle3, DataGridColStyle4}
DataGridWijziging.TableStyles.Add(DaGridTableStyle)
I need somebody’s help with the following
I tried to display data to a DataGrid, that is not the problem
But if I try to add a TableStyle to a DataGrid then I don’t get a result ( no data)
If I use the next code, but without a TableStyle, it works
----------------------------------------------------------------------------------------------------------------
'Declaratie
Dim strMedewerker As Strin
'Set de standaard medewerker in de strMedewerker strin
strMedewerker = "Marco Di Gregorio
'Alle velden leegmake
If DataGridWijziging.Text >= "" The
txtBeginDatum.Text = "
txtEindDatum.Text = "
objDsDGWijziging.Tables.Clear(
DataGridWijziging.DataSource = Nothin
End I
'Datagrid vernieuwe
DataGridWijziging.Refresh(
If txtEindDatum.Text = "" And txtBeginDatum.Text = "" The
'Set de geselecteerd datum in de txtBeginDatum en txtEindDatu
txtBeginDatum.Text = WijzigingsKalender.SelectionStar
txtEindDatum.Text = WijzigingsKalender.SelectionEn
Els
End I
'Connectie make
Dim objConn As OleDb.OleDbConnection = Connectie(
'OleDbCommand voor het uitvoeren van de SQL script aanmake
Dim cmd As New OleDbCommand("SELECT Activiteitomschrijving, Medewerker, Datum, Uren FROM Query_InvoerUren WHERE Medewerker ='" & strMedewerker & "' AND Datum BETWEEN @beginDatum And @EindDatum", objConn
cmd.Parameters.Add("@BeginDatum", CDate(txtBeginDatum.Text)
cmd.Parameters.Add("@EindDatum", CDate(txtEindDatum.Text)
Dim objADaDGWijziging As New OleDbDataAdapter(cmd
'objDatasetDataGridWijziging vulle
objADaDGWijziging.Fill(objDsDGWijziging
'DataGrid vulle
'DataGridWijziging.PreferredColumnWidth = 15
DataGridWijziging.DataSource = objDsDGWijziging.Tables(0
----------------------------------------------------------------------------------------------------------------
If I add the next code then I won’t get my result
----------------------------------------------------------------------------------------------------------------
Dim DaGridTableStyle As New DataGridTableStyl
With DaGridTableStyl
.AlternatingBackColor = Color.GhostWhit
.BackColor = Color.GhostWhit
.ForeColor = Color.MidnightBlu
.GridLineColor = Color.RoyalBlu
.HeaderBackColor = Color.MidnightBlu
.HeaderFont = New Font("Tahoma", 8.0!, FontStyle.Bold
.HeaderForeColor = Color.Lavende
.SelectionBackColor = Color.Tea
.SelectionForeColor = Color.PaleGree
.MappingName = "Query_InvoerUren
.PreferredRowHeight = 1
End Wit
Dim DataGridColStyle1 As New DataGridTextBoxColum
With DataGridColStyle
.HeaderText = "Medewerker
.MappingName = "Medewerker
.Width = 4
.ReadOnly = Tru
End Wit
Dim DataGridColStyle2 As New DataGridTextBoxColum
With DataGridColStyle
.HeaderText = "Activiteitomschrijving
.MappingName = "Activiteitomschrijving
.Width = 15
.ReadOnly = Tru
End Wit
Dim DataGridColStyle3 As New DataGridTextBoxColum
With DataGridColStyle
.HeaderText = "Datum
.MappingName = "Datum
.Width = 2
.ReadOnly = Tru
End Wit
Dim DataGridColStyle4 As New DataGridTextBoxColum
With DataGridColStyle
.HeaderText = "Uren
.MappingName = "Uren
.Width = 1
.ReadOnly = Fals
End Wit
' Add the style objects to the table style's collection of
' column styles. Without this the styles do not take effect.
DaGridTableStyle.GridColumnStyles.AddRange
(New DataGridColumnStyle()
{DataGridColStyle1, DataGridColStyle2, DataGridColStyle3, DataGridColStyle4}
DataGridWijziging.TableStyles.Add(DaGridTableStyle)