Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB.NET
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 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 Search this Thread Display Modes
  #1 (permalink)  
Old January 25th, 2006, 09:26 PM
Authorized User
 
Join Date: Nov 2005
Location: INDIA, Chennai, TAMIL NADU, India.
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
Reply With Quote
  #2 (permalink)  
Old January 26th, 2006, 03:08 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 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.
Reply With Quote
  #3 (permalink)  
Old July 5th, 2007, 01:00 AM
Registered User
 
Join Date: Jun 2007
Location: , , .
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!)

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
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



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


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