Wrox Programmer Forums
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 14th, 2015, 06: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??
 
Old September 17th, 2015, 02: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.
 
Old September 25th, 2015, 03: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()




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 12: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 08: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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.