Forum: ASP.NET |
Thema:
Re: Try catch ?? |
Von:
Thomas Scherner (
01.11.2005 09:00) |
Hallo Mattia,
ich hatte es schon umgeschrieben. Werde mir dein Code mal speichern, ist schön zu wissen das man so die Typen abfragen kann.Mein ganzer Code sieht jetzt so aus und funktioniert super:
Dafür benutze ich Constante für Zuspät etc.
Das Problem war die Darstellung des Feldes aus MSSQL
hier wird dieser Wert " " wieder gegeben.
Private Sub dgResult_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid1.ItemDataBound
Dim SollStart As Date
Dim IstStart As Date
Try
SollStart = CDate(e.Item.Cells(4).Text)
If e.Item.Cells(6).Text = " " Then
If Now > DateAdd(DateInterval.Minute, NICHTDA, SollStart) Then
e.Item.Cells(6).BackColor = Color.Red
End If
Else
IstStart = CDate(e.Item.Cells(6).Text)
If IstStart > DateAdd(DateInterval.Minute, ZUSPAET, SollStart) Then
e.Item.Cells(6).BackColor = Color.Orange
End If
If IstStart < DateAdd(DateInterval.Minute, -ZUFRUEH, SollStart) Then
e.Item.Cells(6).BackColor = Color.Yellow
End If
End If
e.Item.Cells(3).Text = Format(CDate(e.Item.Cells(3).Text), "dd.MM.yyyy")
e.Item.Cells(4).Text = Format(CDate(e.Item.Cells(4).Text), "HH:mm:ss")
e.Item.Cells(5).Text = Format(CDate(e.Item.Cells(5).Text), "HH:mm:ss")
e.Item.Cells(6).Text = Format(CDate(e.Item.Cells(6).Text), "HH:mm:ss")
e.Item.Cells(7).Text = Format(CDate(e.Item.Cells(7).Text), "HH:mm:ss")
Catch
End Try
End Sub
Ich bin ein Newbie . Aber jeder hat mal angefangen. Gruß & Dank Thomas
Antworten
Vorsicht bei der Eingabe: Die Zeichen ' oder -- sind nicht erlaubt!