Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics 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 March 3rd, 2005, 02:42 AM
Registered User
 
Join Date: Mar 2005
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to arctica82
Default problem in using this code in Vb.Net

I have used this code for showing forms by using their names.it works correctly when you are working in one project,but when you have more than one project in you solution and you want to show a form from one of the other projects(although I have added that reference to my project) it does not work the code is as fallows:


        Dim appName As String = Application.ProductName & "."
        Dim mForm As String = "Form3"
        Dim f As Form = DirectCast(Type.GetType(appName & mForm).InvokeMember(mForm, Reflection.BindingFlags.CreateInstance, Nothing, Nothing, Nothing), Form)
        f.Show()

and the error is (object reference not set to an instance of object)

A.G
 
Old April 15th, 2005, 03:05 PM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

in your code,

DirectCast(Type.GetType(appName & mForm).InvokeMember(mForm, Reflection.BindingFlags.CreateInstance, Nothing, Nothing, Nothing), Form)

your target object is Nothing,I think it should be Me

also check out this thread.

HtH.

_____________
Mehdi.
software student.





Similar Threads
Thread Thread Starter Forum Replies Last Post
i need help with my vb.net code zanee All Other Wrox Books 1 February 10th, 2005 09:29 AM
Can'T find code to Beginning Asp.net using VB.NET darruler All Other Wrox Books 1 August 12th, 2004 05:04 PM
ASP.NET Using VB.NET Chapt 3 Code error? uh6uj All Other Wrox Books 1 February 26th, 2004 10:46 AM
Help 'beginning asp.net using vb.net' source code jkmf Wrox Book Feedback 1 January 18th, 2004 08:09 AM





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