I have this code and I have the impresion that all the lines are not exectuted it's like it jumps from line 10 to 14, even when I execute it step by step.
My oUserList Objects is equals nothing when I pass the mouse over it.
Sb has had this problem before?
The error I have is:
System.NullReferenceException: Object reference not set to an instance of an object.
(line 16)
Thanks
I have had something similar happen to me. If you are referencing this class from another project and you reference it from the obj folder ( like obj\debug ) rather than the bin folder and you have added code to the class, then you need to rebuild the class before you try to run the project that references the class. Otherwise, it will jump over the code that you have added since your last rebuild.
1 Public Class UserLendings
2 Inherits System.Web.UI.Page
3 Protected WithEvents DrlUser As System.Web.UI.WebControls.DropDownList
3 Protected WithEvents btnExec As System.Web.UI.WebControls.Button
5 Dim oUserList As New clsUserList()
6 Dim oUser As New clsUser()
7 Protected WithEvents grdProducts As System.Web.UI.WebControls.DataGrid
8 Dim cProductList As New Collection()
9 Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
10 If Not IsPostBack Then 'Put user code to initialize the page here
11 DrlUser.DataSource = oUserList.GetAllUsers
12 DrlUser.DataValueField = "userid"
13 DrlUser.DataTextField = "userName"
14 DrlUser.DataBind()
15 DrlUser.SelectedIndex = 0
16 End If
17 End Sub
If you just hit F5 and have the system automatically rebuild the projects before running\debugging, you still have this problem. You have to manually tell the system to rebuild the class.
Hope this helps.
MajorCats
0 comments:
Post a Comment