|
-
Jul 26th, 2004, 03:32 PM
#1
Thread Starter
Member
Object reference not set to an instance of an object...HELP
I found this great component on component 1 that does paypal for VB.net. The problem lies when I try to make it work in the code. This is what I have.
VB Code:
Protected WithEvents C1AddToCart1 As C1.Web.C1PayPal.C1AddToCart
Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
C1AddToCart1.CurrencyCode = C1.Web.C1PayPal.CurrencyEnum.USDollars
C1AddToCart1.Business = "******@hotmail.com"
C1AddToCart1.ItemName = "Test Item"
C1AddToCart1.ItemNumber = "0010001"
C1AddToCart1.ItemPrice = 15.95
end Sub
But when I press the button I get an Object Reference not set to an instance of an object:
This is the stack trace
[NullReferenceException: Object reference not set to an instance of an object.]
WebApplication1.basic_customize.btnSubmit_Click(Object sender, EventArgs e) in C:\Documents and Settings\Cran56\VSWebCache\dirteelinens.com\basic_customize.ascx.vb:119
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +108
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1277
I have no clue why it's having a problem.
Thanks,
Cran56
-
Jul 26th, 2004, 04:32 PM
#2
Frenzied Member
Even though you're Dim-ing your C1AddToCart1 as an object type, you never initialize it. Try something like .. As New C1.Web.C1PayPal.C1AddToCart, or maybe call a method that return an instance of that object, if available.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|