troubleshooting Question

problem with databinding

Avatar of fosiul01
fosiul01Flag for United Kingdom of Great Britain and Northern Ireland asked on
.NET ProgrammingASP.NET
13 Comments2 Solutions237 ViewsLast Modified:
Hi , i am following a book to learn about data binding

i wrote this function dataload()  in exam.vb.
now i want to call this function from web form, but its saying, " name data load not declared"

where is the problem ??

Thanks in advance

Imports Microsoft.VisualBasic
Imports System.Data
Module exam
 
 
    Public Class exam
        Public Function DataLoad() As ICollection
            Dim dt As DataTable = New DataTable()
            Dim dv As DataView
            Dim dr As DataRow
 
            ' Add two columns to the DataTable
            dt.Columns.Add(New DataColumn( _
             "ExamNumber", GetType(String)))
            dt.Columns.Add(New DataColumn( _
            "ExamName", GetType(String)))
 
            ' Put some data in
            dr = dt.NewRow()
            dr(0) = "305"
            dr(1) = "Web Applications With VB.NET"
            dt.Rows.Add(dr)
 
            dr = dt.NewRow()
            dr(0) = "306"
            dr(1) = "Windows Applications With VB.NET"
            dt.Rows.Add(dr)
 
            dr = dt.NewRow()
            dr(0) = "310"
            dr(1) = "XML With VB.NET"
            dt.Rows.Add(dr)
 
            dr = dt.NewRow()
            dr(0) = "315"
            dr(1) = "Web Applications With Visual C# .NET"
            dt.Rows.Add(dr)
 
            dr = dt.NewRow()
            dr(0) = "316"
            dr(1) = _
             "Windows Applications With Visual C# .NET"
            dt.Rows.Add(dr)
 
            dr = dt.NewRow()
            dr(0) = "320"
            dr(1) = "XML With Visual C# .NET"
            dt.Rows.Add(dr)
 
            ' And return the datatable
            ' wrapped in a dataview
            dv = New DataView(dt)
            Return dv
 
        End Function
 
    End Class
End Module
 
 
webform :
 
 
Partial Class thankyou
    Inherits System.Web.UI.Page
   
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
 
 
        lbExams.DataSource = DataLoad()
        lbExams.DataTextField = "ExamName"
        DataBind()
 
 
    End Sub
 
    
End Class
ASKER CERTIFIED SOLUTION
the_bachelor

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 13 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 13 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros