473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Object Variable Or With Block Variable Not Set

I get this error from an application:

Expand|Select|Wrap|Line Numbers
  1. ************** Exception Text **************
  2. System.NullReferenceException: Object variable or With block variable not set.
  3.    at Microsoft.VisualBasic.CompilerServices.Symbols.Container..ctor(Object Instance)
  4.    at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
  5.    at VRN2a_Models_Options.Form1.Form1_Load(Object sender, EventArgs e)
  6.    at System.Windows.Forms.Form.OnLoad(EventArgs e)
  7.    at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
  8.    at System.Windows.Forms.Control.Show()
  9.    at VRN2a_Models_Options.MDIParent1.MDIParent1_Load(Object sender, EventArgs e)
  10.    at System.Windows.Forms.Form.OnLoad(EventArgs e)
  11.    at System.Windows.Forms.Form.OnCreateControl()
  12.    at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
  13.    at System.Windows.Forms.Control.CreateControl()
  14.    at System.Windows.Forms.Control.WmShowWindow(Message& m)
  15.    at System.Windows.Forms.Control.WndProc(Message& m)
  16.    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
  17.    at System.Windows.Forms.ContainerControl.WndProc(Message& m)
  18.    at System.Windows.Forms.Form.WmShowWindow(Message& m)
  19.    at System.Windows.Forms.Form.WndProc(Message& m)
  20.    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
  21.    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
  22.    at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  23.  
  24. ************** Loaded Assemblies **************
  25. mscorlib
  26.     Assembly Version: 2.0.0.0
  27.     Win32 Version: 2.0.50727.3615 (GDR.050727-3600)
  28.     CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
  29. ----------------------------------------
  30. VRN2a Models Options
  31.     Assembly Version: 1.0.0.0
  32.     Win32 Version: 1.0.0.0
  33.     CodeBase: file:///C:/Documents%20and%20Settings/morriss_p/Local%20Settings/Apps/2.0/BA8VWVAP.CPT/2Y61TC6P.XBP/vrn2..tion_f15f9888301d2ca9_0001.0000_c3502c14864e9693/VRN2a%20Models%20Options.exe
  34. ----------------------------------------
  35. Microsoft.VisualBasic
  36.     Assembly Version: 8.0.0.0
  37.     Win32 Version: 8.0.50727.3053 (netfxsp.050727-3000)
  38.     CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
  39. ----------------------------------------
  40. System
  41.     Assembly Version: 2.0.0.0
  42.     Win32 Version: 2.0.50727.3614 (GDR.050727-3600)
  43.     CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
  44. ----------------------------------------
  45. System.Windows.Forms
  46.     Assembly Version: 2.0.0.0
  47.     Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
  48.     CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
  49. ----------------------------------------
  50. System.Drawing
  51.     Assembly Version: 2.0.0.0
  52.     Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
  53.     CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
  54. ----------------------------------------
  55. System.Runtime.Remoting
  56.     Assembly Version: 2.0.0.0
  57.     Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
  58.     CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
  59. ----------------------------------------
  60. Microsoft.Office.Interop.Excel
  61.     Assembly Version: 11.0.0.0
  62.     Win32 Version: 11.0.5530
  63.     CodeBase: file:///C:/WINDOWS/assembly/GAC/Microsoft.Office.Interop.Excel/11.0.0.0__71e9bce111e9429c/Microsoft.Office.Interop.Excel.dll
  64. ----------------------------------------
  65. Accessibility
  66.     Assembly Version: 2.0.0.0
  67.     Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000)
  68.     CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Accessibility/2.0.0.0__b03f5f7f11d50a3a/Accessibility.dll
  69. ----------------------------------------
  70. AxInterop.SHDocVw
  71.     Assembly Version: 1.1.0.0
  72.     Win32 Version: 1.1.0.0
  73.     CodeBase: file:///C:/Documents%20and%20Settings/morriss_p/Local%20Settings/Apps/2.0/BA8VWVAP.CPT/2Y61TC6P.XBP/vrn2..tion_f15f9888301d2ca9_0001.0000_c3502c14864e9693/AxInterop.SHDocVw.DLL
  74. ----------------------------------------
  75. Interop.SHDocVw
  76.     Assembly Version: 1.1.0.0
  77.     Win32 Version: 1.1.0.0
  78.     CodeBase: file:///C:/Documents%20and%20Settings/morriss_p/Local%20Settings/Apps/2.0/BA8VWVAP.CPT/2Y61TC6P.XBP/vrn2..tion_f15f9888301d2ca9_0001.0000_c3502c14864e9693/Interop.SHDocVw.DLL
  79. ----------------------------------------
The application runs fine on the developement PC, but not on another PC.
It looks like the error is here somewhere:



Expand|Select|Wrap|Line Numbers
  1. Imports Microsoft.Office.Interop.Excel 
  2.  
  3.  
  4. Imports AxMicrosoft.Office.Interop.Owc11 
  5.  
  6.  
  7. Public Class Form1 
  8.  
  9. Inherits System.Windows.Forms.Form 
  10.  
  11. Public oDocument As Microsoft.Office.Interop.Excel.Workbook 
  12.  
  13. Public CSDWkBook As Microsoft.Office.Interop.Excel.Workbook 
  14.  
  15. Public CSDApp As Microsoft.Office.Interop.Excel._Application 
  16.  
  17. Public oDocApp As Microsoft.Office.Interop.Excel._Application 
  18.  
  19. Public AppPath As String = System.AppDomain.CurrentDomain.BaseDirectory
  20.  
  21.  
  22. Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
  23.  
  24. Dim UnitWrkBk As String
  25.  
  26.  
  27. Dim IndTenDigit As String = Strings.Left(Navigate_Form.IndUnitsComboBox.Text, 10) 
  28.  
  29. Dim IndEditType As String = Strings.Left(EditCSD.IndUnitType, 15) 
  30.  
  31. Me.WindowState = FormWindowState.Maximized 
  32.  
  33. 'Determine with unit workbook to open
  34.  
  35.  
  36.  
  37.  
  38. If Navigate_Form.RadioButtonVRN2aFO.Checked = True Then
  39.  
  40. UnitWrkBk = AppPath & "Excel Files\vrn2a.xls"
  41.  
  42. Me.AxWebBrowser1.Navigate(UnitWrkBk) 
  43.  
  44. ElseIf IndTenDigit = "THM0010433" Or IndTenDigit = "THM0010425" Or IndEditType = "Sabre VRN2a Ind" Then
  45.  
  46.  
  47. UnitWrkBk = AppPath & "Excel Files\vrn2aInd.xls"
  48.  
  49. Me.AxWebBrowser1.Navigate(UnitWrkBk) 
  50.  
  51. ElseIf Navigate_Form.RadioButtonVRN6aFO.Checked = True Then
  52.  
  53.  
  54. UnitWrkBk = AppPath & "Excel Files\vnr6a.xls"
  55.  
  56. Me.AxWebBrowser1.Navigate(UnitWrkBk) 
  57.  
  58. ElseIf IndTenDigit = "THM0010413" Then
  59.  
  60.  
  61. UnitWrkBk = AppPath & "Excel Files\VRN6aInd.xls"
  62.  
  63. Me.AxWebBrowser1.Navigate(UnitWrkBk) 
  64.  
  65. ElseIf Navigate_Form.RadioButtonVREaFO.Checked = True Then
  66.  
  67.  
  68. UnitWrkBk = AppPath & "Excel Files\VREa.xls"
  69.  
  70. Me.AxWebBrowser1.Navigate(UnitWrkBk) 
  71.  
  72. ElseIf IndTenDigit = "THM0010417" Or IndTenDigit = "THM0010420" Then
  73.  
  74.  
  75. UnitWrkBk = AppPath & "Excel Files\VREaInd.xls"
  76.  
  77. Me.AxWebBrowser1.Navigate(UnitWrkBk) 
  78.  
  79. ElseIf Navigate_Form.RadioButtonVCEaFO.Checked = True Then
  80.  
  81.  
  82. UnitWrkBk = AppPath & "Excel Files\VCEa.xls"
  83.  
  84. Me.AxWebBrowser1.Navigate(UnitWrkBk) 
  85.  
  86. ElseIf IndTenDigit = "THM0010440" Or IndTenDigit = "THM0010438" Or IndTenDigit = "THM0010434" Then
  87.  
  88.  
  89. UnitWrkBk = AppPath & "Excel Files\VCEaInd.xls"
  90.  
  91. Me.AxWebBrowser1.Navigate(UnitWrkBk) 
  92.  
  93. ElseIf Navigate_Form.RadioButtonSSEaFO.Checked = True Then
  94.  
  95.  
  96. UnitWrkBk = AppPath & "Excel Files\SSEa.xls"
  97.  
  98. Me.AxWebBrowser1.Navigate(UnitWrkBk) 
  99.  
  100. ElseIf IndTenDigit = "THM0010441" Then
  101.  
  102.  
  103. UnitWrkBk = AppPath & "Excel Files\SSEaInd.xls"
  104.  
  105. Me.AxWebBrowser1.Navigate(UnitWrkBk) 
  106.  
  107. ElseIf Navigate_Form.RadioButtonDSEaFO.Checked = True Then
  108.  
  109.  
  110. UnitWrkBk = AppPath & "Excel Files\DSEa.xls"
  111.  
  112. Me.AxWebBrowser1.Navigate(UnitWrkBk) 
  113.  
  114. ElseIf IndTenDigit = "THM0010474" Then
  115.  
  116.  
  117. UnitWrkBk = AppPath & "Excel Files\DSEaInd.xls"
  118.  
  119. Me.AxWebBrowser1.Navigate(UnitWrkBk) 
  120.  
  121. ElseIf Navigate_Form.RadioButtonAMUFO.Checked = True Then
  122.  
  123.  
  124. UnitWrkBk = AppPath & "Excel Files\AMU.xls"
  125.  
  126. Me.AxWebBrowser1.Navigate(UnitWrkBk) 
  127.  
  128. End If
  129.  
  130.  
  131. oDocApp = AxWebBrowser1.Document.Application
  132.  
  133. oDocument = AxWebBrowser1.Document
  134.  
  135. oDocApp.DisplayFormulaBar = False 
  136.  
  137.  
  138.  
  139.  
  140. End Sub


Thank you
Nov 30 '10 #1
0 1401

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: MARK | last post by:
When i attempt to set my 'picture' background for my sub-form i get the error "OBJECT BLOCK OR WITH BLOCK VARIABLE NOT SET". The main form has a background set using the 'picture' in the...
3
by: Joe Schwartz | last post by:
All, Could somebody please help me out here. I am getting an "Object variable or With block variable not set" error with the following code. This happens when I enter a value into the "ponum"...
0
by: RJN | last post by:
Hi Sorry for posting again. I'm calling a shared method in the class. The following error is found in production though I'm not able to reproduce. ...
6
by: Neo Geshel | last post by:
I am trying to deal with an image in code-behind. I consistently get the following error: Server Error in '/' Application. Object variable or With block variable not set. Description: An...
3
by: Richard Hollenbeck | last post by:
I've marked the line in this subroutine where I've been getting this error. It may be something stupid but I've been staring at this error trying to fix it for over an hour. I'm pretty sure the...
9
by: axs221 | last post by:
I am trying to move some of our large VBA Access front-end file into ActiveX DLL files. I created two DLL files so far, one was a module that contains code to integrate into the QuickBooks...
1
by: abhijmenbumca07 | last post by:
Object variable or With block variable not set. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information...
4
by: BrianAdev | last post by:
Why It throw an error of <Object variable or With block variable not set> set objAccess = GetObject(strMdbPath) objAccess.DoCmd.SetWarning False objAccess.DoCmd.OpenReport strReportName, 0 'It...
3
by: Newbie19 | last post by:
I'm trying to get a list of all subfolders in a folder on a share drive, but I keep on getting this error message: Object variable or With block variable not set. Description: An unhandled...
5
by: Al G | last post by:
Hi, I'm converting a bit of POP3 VB6 code to VB2005, and have run into this error with the following code. Can someone help me find out what I'm missing/doing wrong? 'holds the attachments...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.