hai everyone, i have a problem when i want to update from gridview the error message is display
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 133: Dim Jumlah As Double = 0.0
Line 134: Jumlah = (Kuiz1 + Kuiz2 + Kuiz3 + Kuiz4 + Kuiz5)
Line 135: litJumlah.Text = Jumlah
Line 136: Dim Purata As Double = 0.0
Line 137: Purata = (Kuiz1 + Kuiz2 + Kuiz3 + Kuiz4 + Kuiz5) / 25 * 5
Source File: C:\Users\fatinamy\Documents\Visual Studio 2008\WebSites\WebSite5\pensyarah\papanpemuka2.aspx.vb Line: 135
my code is:
Protected Sub GVPapar_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim litPurata As Literal = DirectCast(e.Row.FindControl("litPurata"), Literal)
Dim litJumlah As Literal = DirectCast(e.Row.FindControl("litJumlah"), Literal)
Dim Kuiz1 As Double = Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "KUIZ1"))
Dim Kuiz2 As Double = Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "KUIZ2"))
Dim Kuiz3 As Double = Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "KUIZ3"))
Dim Kuiz4 As Double = Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "KUIZ4"))
Dim Kuiz5 As Double = Convert.ToDouble(DataBinder.Eval(e.Row.DataItem, "KUIZ5"))
Dim Jumlah As Double = 0.0
Jumlah = (Kuiz1 + Kuiz2 + Kuiz3 + Kuiz4 + Kuiz5)
litJumlah.Text = Jumlah
Dim Purata As Double = 0.0
Purata = (Kuiz1 + Kuiz2 + Kuiz3 + Kuiz4 + Kuiz5) / 25 * 5
litPurata.Text = Purata
'litJumlah.Text = Convert.ToString(Jumlah)
'litPurata.Text = Convert.ToString(Purata)
If Jumlah < 9 Then
e.Row.CssClass = "red"
ElseIf 10 < Jumlah < 15 Then
e.Row.CssClass = "yellow"
Else
e.Row.CssClass = "green"
End If
End If
End Sub