Sure no problem.
The problem is that this is a globally declared dataset that needed the data
in the sort order for the report writing functions in another module. I
could have used the dataview but then when they went to write the report the
order would be wrong. If I change to a globally declared dataview I was
concerned what effect it would have on my excel and word reports (I have
never tried to write a dataview to an excel spreadsheet so it may be
possible).
Another problem has been encountered that my interest you.
DATEOR is a date column in the dataset. The task is to format the column to
get the (12:00:00) time off and color the box is the value of backorders > 0
and days > 90.
However though it is appearing as I wanted it too and sorting as I requested
it to, the yellow has been lost.
Can you suggest what I am doing wrong?
I have a class for my datagrid called ClassDatagridFormat
one if ...Then procedure says:
If Me.MappingName = "DATEOR" Then
Dim ObjVal As Object
ObjVal = Me.GetColumnValueAtRow(curmngrSrc, RowNumber)
Dim days As Integer
Dim cellValue As String
cellValue = CType(ObjVal, Date).ToShortDateString
days = DateDiff(DateInterval.Day, CDate(cellValue),
CDate(timeofrecord))
If days >= 90 And backorders = 0 Then
BackColorBrush = System.Drawing.Brushes.Yellow
End If
If days >= 90 And backorders > 0 Then
BackColorBrush = System.Drawing.Brushes.White
End If
If days < 90 Then
BackColorBrush = System.Drawing.Brushes.White
End If
ForeColorBrush = Brushes.Black
MyBase.Paint(graph, rectbounds, curmngrSrc, RowNumber, _
BackColorBrush, ForeColorBrush, AlignmentLeft)
'DataAlignment = HorizontalAlignment.Center
graph.FillRectangle(BackColorBrush, rectbounds)
'draw the value
Dim s As String = Me.GetColumnValueAtRow([curmngrSrc],
RowNumber).ToString()
Dim r As New RectangleF(rectbounds.X, rectbounds.Y,
rectbounds.Width, rectbounds.Height)
graph.DrawString(s, MyBase.TextBox.Font, ForeColorBrush, r,
mDrawTxt)
Me.TextBox.ReadOnly = True
mTxtAlign = HorizontalAlignment.Left
mDrawTxt.LineAlignment = StringAlignment.Center
'Exit Sub
End If
The call in the form to this Class is :
Dim myCurrencyManger As CurrencyManager = CType(Me.BindingContext(opends1),
CurrencyManager)
Dim proprtyDescriptorName As PropertyDescriptor =
myCurrencyManger.GetItemProperties()(opends1.Tables(0).TableName)
Dim myDateDescriptor As PropertyDescriptor =
myCurrencyManger.GetItemProperties()("DATEOR")
Dim myDateStyle = New DataGridTextBoxColumn(myDateDescriptor, "G")
myDateStyle.MappingName = "DATEOR"
myDateStyle.HeaderText = "DATE"
myDateStyle.Width = 75
myDateStyle.Format = "d"
By the way, are you ready for the "article"?
The problem is that this dataset is declared globally