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 > BOOK: Professional ASP.NET 4.5 : in C# and VB
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional ASP.NET 4.5 : in C# and VB
This is the forum to discuss the Wrox book Professional ASP.NET 4.5 in C# and VB by Jason N. Gaylord, Christian Wenz, Pranav Rastogi, Todd Miranda, Scott Hanselman; ISBN: 978-1-1183-1182-0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 4.5 : 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 September 14th, 2015, 07:41 AM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2015
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Variable mu is passed by reference error

I have a question on the ReadUserFile method and ValudateUser function

Page 576 VB code

Try
ReadUserFile()

Dim mu as MembershipUser

If (_MyUsers.TryGetValue(username.ToLower(), mu)) then


I get following warning:
Warning 1 Variable 'mu' is passed by reference before it has been assigned a value. A null reference exception could result at runtime.

Do I need to use framework 4.5. My app is in 4.0 ?
I put the code as listed and I get this??
Reply With Quote
  #2 (permalink)  
Old September 17th, 2015, 03:17 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2015
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default solution found on google

Dim mu As MembershipUser = Nothing

Feel like a ditz.
Reply With Quote
  #3 (permalink)  
Old September 25th, 2015, 04:31 AM
Registered User
Points: 12, Level: 1
Points: 12, Level: 1 Points: 12, Level: 1 Points: 12, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2015
Location: UK
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You need to assign a MembershipUser object to the references:

Code:
Dim mu As MembershipUser = New MembershipUser()
Or:
Code:
Dim mu As New MembershipUser()
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
I need help with php variable passed to perl... nriv08 Beginning PHP 0 October 9th, 2008 01:54 PM
Objects are always passed by reference or value? deb_kareng C# 2 November 2nd, 2006 03:53 AM
java's argument is passed by value or by reference ousys Java Basics 4 July 1st, 2006 09:33 PM
Global variable passed from s/proc not accepted ssharrock SQL Server DTS 1 February 24th, 2005 12:28 AM
Can't display input variable passed on to php code mespejo Beginning PHP 2 November 25th, 2003 03:32 PM



All times are GMT -4. The time now is 05:02 AM.


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