G
Guest
i have write code in that updates details of student and then present it in a
different panel i n the same. however a recieve object reference not set to
an instance of an object.
Can someone please help me to correct it. below is the sub where the error
is trapped.
Sub UpdateStudent_Click(ByVal sender As Object, ByVal e As EventArgs)
If Page.IsValid = True Then
Dim tbTitle As TextBox
Dim tbStatus As TextBox
Dim tbSurname As TextBox
Dim tbFirstname As TextBox
Dim tbHouseNumber As TextBox
Dim tbStreet As TextBox
Dim tbTown As TextBox
Dim tbCounty As TextBox
Dim tbCountry As TextBox
Dim tbPostCode As TextBox
Dim tbDateOfBirth As TextBox
Dim tbNationality As TextBox
Dim tbTelephone As TextBox
Dim tbMobile As TextBox
Dim tbEmail As TextBox
Dim tbFax As TextBox
Dim tbCourseID As TextBox
Dim tbDateEnroled As TextBox
Dim tbComment As TextBox
Dim item As DataListItem
For Each item In UpdateDataList.Items
tbTitle = item.FindControl("Title")
tbStatus = item.FindControl("Status")
tbSurname = item.FindControl("Surname")
tbFirstname = item.FindControl("Firstname")
tbHouseNumber = item.FindControl("HouseNumber")
tbStreet = item.FindControl("Street")
tbTown = item.FindControl("Town")
tbCounty = item.FindControl("County")
tbCountry = item.FindControl("Country")
tbPostCode = item.FindControl("Postcode")
tbDateOfBirth = item.FindControl("DateOfBirth")
tbNationality = item.FindControl("Nationality")
tbTelephone = item.FindControl("Telephone")
tbMobile = item.FindControl("Mobile")
tbEmail = item.FindControl("email")
tbFax = item.FindControl("Fax")
tbCourseID = item.FindControl("CourseID")
tbDateEnroled = item.FindControl("DateEnroled")
tbComment = item.FindControl("Comment")
Next item
Dim StudentID As Integer = CInt(ViewState("StudentID"))
Dim UpdateDetails As New StudentDB
UpdateDetails.UpdateStudentDetails(StudentID, tbTitle.Text,
tbSurname.Text, tbFirstname.Text, tbHouseNumber.Text, tbStreet.Text,
tbTown.Text, tbCounty.Text, tbCountry.Text, tbPostCode.Text,
tbDateOfBirth.Text, tbNationality.Text, tbTelephone.Text, tbMobile.Text,
tbEmail.Text, tbFax.Text, tbCourseID.Text, tbDateEnroled.Text, tbStatus.Text,
tbComment.Text)
BindViewPanel()
End If
End Sub
different panel i n the same. however a recieve object reference not set to
an instance of an object.
Can someone please help me to correct it. below is the sub where the error
is trapped.
Sub UpdateStudent_Click(ByVal sender As Object, ByVal e As EventArgs)
If Page.IsValid = True Then
Dim tbTitle As TextBox
Dim tbStatus As TextBox
Dim tbSurname As TextBox
Dim tbFirstname As TextBox
Dim tbHouseNumber As TextBox
Dim tbStreet As TextBox
Dim tbTown As TextBox
Dim tbCounty As TextBox
Dim tbCountry As TextBox
Dim tbPostCode As TextBox
Dim tbDateOfBirth As TextBox
Dim tbNationality As TextBox
Dim tbTelephone As TextBox
Dim tbMobile As TextBox
Dim tbEmail As TextBox
Dim tbFax As TextBox
Dim tbCourseID As TextBox
Dim tbDateEnroled As TextBox
Dim tbComment As TextBox
Dim item As DataListItem
For Each item In UpdateDataList.Items
tbTitle = item.FindControl("Title")
tbStatus = item.FindControl("Status")
tbSurname = item.FindControl("Surname")
tbFirstname = item.FindControl("Firstname")
tbHouseNumber = item.FindControl("HouseNumber")
tbStreet = item.FindControl("Street")
tbTown = item.FindControl("Town")
tbCounty = item.FindControl("County")
tbCountry = item.FindControl("Country")
tbPostCode = item.FindControl("Postcode")
tbDateOfBirth = item.FindControl("DateOfBirth")
tbNationality = item.FindControl("Nationality")
tbTelephone = item.FindControl("Telephone")
tbMobile = item.FindControl("Mobile")
tbEmail = item.FindControl("email")
tbFax = item.FindControl("Fax")
tbCourseID = item.FindControl("CourseID")
tbDateEnroled = item.FindControl("DateEnroled")
tbComment = item.FindControl("Comment")
Next item
Dim StudentID As Integer = CInt(ViewState("StudentID"))
Dim UpdateDetails As New StudentDB
UpdateDetails.UpdateStudentDetails(StudentID, tbTitle.Text,
tbSurname.Text, tbFirstname.Text, tbHouseNumber.Text, tbStreet.Text,
tbTown.Text, tbCounty.Text, tbCountry.Text, tbPostCode.Text,
tbDateOfBirth.Text, tbNationality.Text, tbTelephone.Text, tbMobile.Text,
tbEmail.Text, tbFax.Text, tbCourseID.Text, tbDateEnroled.Text, tbStatus.Text,
tbComment.Text)
BindViewPanel()
End If
End Sub