Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
|
VB.NET General VB.NET discussions for issues that don't fall into other VB.NET forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 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 January 25th, 2006, 09:26 PM
Authorized User
 
Join Date: Nov 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default Error - Object reference not set to an instance ?

Dear all,
Development in VB .NET 2003 / SqlSever express & MS-Access (option).

I am getting the following error while connecting forms in menu.

[u]"Object reference not set to an instance of an object"</u>

I'm using the following commands.
''' Sample code for your reference....
      Dim bm As TrialDB
      bm.Show()
      bm.ActiveForm.Enabled = True
      bm.ActiveForm.Focus()

I have a table in MS-Access - connecting thru OLEDB

Please guide me by giving some sample codes to connect my forms to menu.

thanks

venkatesh

VENKATESH
__________________
VENKATESH
 
Old January 26th, 2006, 03:08 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

The error message is correct. You are not creating a new instance of the TrialDB object, ALl you do is declare a variable, so the code will crash when you try to call a method on it. Change it to this:
Code:
Dim bm As New TrialDB
bm.Show()
bm.ActiveForm.Enabled = True
bm.ActiveForm.Focus()
This should work if TrialDB has a default constructor (that doesn't accept parameters).

HtH,

Imar

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old July 5th, 2007, 01:00 AM
Registered User
 
Join Date: Jun 2007
Posts: 4
Thanks: 0
Thanked 1 Time in 1 Post
Default

object reference not set to an instance of an object - when I try to create a VSTO project I get this error. I have installed VSTO on 3 WinXP VS8 configs, each with a different problem (the others are required PIA's and Office 11 SP1 despite the machine running Office 12).... however, this is a regularly discussed error so I wondered if someone could point me in the direction of a clue....?

The Add-ins Detective (seriously, my life is nothing else right now!)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Object reference not set to an instance of an obje hertendreef ASP.NET 2.0 Basics 3 July 1st, 2007 02:16 PM
Error: Object Reference not set to an instance. Nosfe_X VB Databases Basics 2 June 23rd, 2006 04:10 PM
Object reference not set to an instance of an obj. Dwizz VB.NET 2002/2003 Basics 8 June 1st, 2005 08:28 AM
Object Reference is Not Set to an Instance of an O blackinwhite General .NET 4 February 1st, 2005 05:42 AM
Object reference not set to an instance... steelman BOOK: ASP.NET Website Programming Problem-Design-Solution 6 May 7th, 2004 02:03 AM





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