Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4.5.1 > BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Beginning ASP.NET 4.5.1 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4.5.1: in C# and VB by Imar Spaanjaars; ISBN: 978-1-118-84677-3
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4.5.1 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old June 12th, 2018, 02:52 PM
Registered User
Points: 13, Level: 1
Points: 13, Level: 1 Points: 13, Level: 1 Points: 13, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2018
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default I'm getting a Nullexceptiontype - Object Reference Variable Not Set

Hi,

I'm getting following error on my boolean variable assignment. Could you please help with this error (kind of urgent)? Thank You:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If IsNothing(Initialized) = True Then
Initialized = False
PrevLoc = ""
End If
End Sub

Private Sub GridView1_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GridView1.RowDataBound
Dim CurrentLoc As String
Dim drv As DataRowView


If IsNothing(Initialized) = False Then
Dim X
X = Initialized
MsgBox("Orhan")
X = True
Initialized = X
drv = e.Row.DataItem("Loc")
PrevLoc = drv.Row.Item("Loc")
PreviousColor = System.Drawing.Color.Blue

Exit Sub
End If


If e.Row.RowType = DataControlRowType.DataRow And Initialized = True Then

drv = e.Row.DataItem

CurrentLoc = drv("Loc").ToString()

If CurrentLoc <> PrevLoc Then
If PreviousColor = System.Drawing.Color.Blue Then
e.Row.BackColor = System.Drawing.Color.Green
PreviousColor = System.Drawing.Color.Green
Else
e.Row.BackColor = System.Drawing.Color.Blue
PreviousColor = System.Drawing.Color.Blue
End If


End If



End If

PrevLoc = CurrentLoc


End Sub
Reply With Quote
  #2 (permalink)  
Old June 12th, 2018, 02:57 PM
Imar's Avatar
Wrox Author
Points: 71,692, Level: 100
Points: 71,692, Level: 100 Points: 71,692, Level: 100 Points: 71,692, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,020
Thanks: 79
Thanked 1,581 Times in 1,558 Posts
Default

Which chapter / page / exercise is this referring to? Is this even from an ASPX project? (MsgBox seems like a bad idea for a web app).

Also, which "following error" are you talking about it? When do you get it? What's the exact error message and location / line?

And finally, what is it you're trying to accomplish?

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
  #3 (permalink)  
Old June 12th, 2018, 03:04 PM
Registered User
Points: 13, Level: 1
Points: 13, Level: 1 Points: 13, Level: 1 Points: 13, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2018
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default I'm getting a Nullexceptiontype - Object Reference Variable Not Set

Hi Imar,

I was using MsgBox to debug my code. I'm trying to have on my grid rows if Grid column (Loc) changes then change color from green to blue or blue to green. Because this web app will be displayed on two 70 in. TV monitors ;) My customer requested this for my final requirement task.

I hope this helps. Thank you!

Orhan (Systems Developer, Analyst and Engineer (Ordinary))
Reply With Quote
  #4 (permalink)  
Old June 12th, 2018, 03:13 PM
Imar's Avatar
Wrox Author
Points: 71,692, Level: 100
Points: 71,692, Level: 100 Points: 71,692, Level: 100 Points: 71,692, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,020
Thanks: 79
Thanked 1,581 Times in 1,558 Posts
Default

See my previous message. Can't help you without proper info. Does this relate to a specific exercise or page in my book? If not, you might be better off find a better forum category here (VB, ASP.NET?) to get better responses.

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Chap 14 - pg 517 - Item 9 (Object reference not set to an instance of an object. ) jkoyle BOOK: Beginning ASP.NET 4 : in C# and VB 5 August 25th, 2011 08:50 AM
Getting Error: Object reference not set to an instance of an object. oruckenan BOOK: Beginning ASP.NET 4 : in C# and VB 2 August 23rd, 2011 02:18 PM
Error - Object reference not set to an instance of an object Phil Critchley ASP.NET 4 General Discussion 2 April 30th, 2011 05:18 AM
Chap 13 pg448: Object reference not set to an instance of an object tomche BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 15 August 8th, 2009 06:14 AM
Object reference not set to an instance of object iceman90289 ASP.NET 3.5 Basics 1 March 1st, 2009 04:13 AM



All times are GMT -4. The time now is 09:53 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.