ChristianBG

below i have a sub and the error that is generated when it runs on certain computers. i dont understand why on one machine the sub would generate an NullReference to tcItemMaintenance and when others run the same code it is fine. Needless to say all the machines it works on have been machines that have VS2005 on the, any help would be appreciated, thank you

Private Sub RemoveTabPagesFromTabControl(ByVal inBuildCollection As Boolean)

Dim localTabPage As New TabPage

Dim localCount As Int16 = 0

collActiveTabPages.Clear()

If inBuildCollection = True Then

MsgBox(tcItemMaintenance.Name)

While localCount < tcItemMaintenance.TabPages.Count ****Error happens on this line

localTabPage = tcItemMaintenance.TabPages(localCount)

collTabPages.Add(localCount, localTabPage)

localCount += 1

End While

End If

'tcItemMaintenance.Visible = False

tcItemMaintenance.TabPages.Clear()

'always display the first tab

localTabPage = collTabPages.GetByIndex(0)

If Not cmbProductType.Text = xCHOOSEITEMTYPE Then

localTabPage.Text = cmbProductType.Text + " Maintenance"

Else

localTabPage.Text = ""

End If

tcItemMaintenance.TabPages.Add(localTabPage)

If Not collActiveTabPages.ContainsKey(0) Then

collActiveTabPages.Add(0, localTabPage)

End If

End Sub

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at ItemMaintenance.frmItemDesktop.RemoveTabPagesFromTabControl(Boolean inBuildCollection)
at ItemMaintenance.frmItemDesktop.frmParts_Load(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
mscorlib
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
Item Maintenance Install
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///X:/CFC%20Software%20Suites/Item%20Maintenance.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 8.0.0.0
Win32 Version: 8.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
----------------------------------------
System.DirectoryServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.DirectoryServices/2.0.0.0__b03f5f7f11d50a3a/System.DirectoryServices.dll
----------------------------------------
CFCSecurityPackage
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///X:/CFC%20Software%20Suites/CFCSecurityPackage.DLL
----------------------------------------
CFCBaseClassPackage
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///X:/CFC%20Software%20Suites/CFCBaseClassPackage.DLL
----------------------------------------
System.Data
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data/2.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Xml
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
CFCOracleConnectionPackage
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///X:/CFC%20Software%20Suites/CFCOracleConnectionPackage.DLL
----------------------------------------
System.Data.OracleClient
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Data.OracleClient/2.0.0.0__b77a5c561934e089/System.Data.OracleClient.dll
----------------------------------------
System.Configuration
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Web
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Web/2.0.0.0__b03f5f7f11d50a3a/System.Web.dll
----------------------------------------
System.Transactions
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.Transactions/2.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
Assembly Version: 2.0.0.0
Win32 Version: 2.0.50727.832 (QFE.050727-8300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_32/System.EnterpriseServices/2.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.




Re: Windows Forms Designer works on VS2005 Machines and does not work on NON VS2005 machines

Pravin Chandankhede

hi

what is this Item Maintenance Install assenbly that cab be seen in ur exception log

is it a third party component, make sure its installed on ur machine. same for CFCOracleConnectionPackage

also make sure that in line

While localCount < tcItemMaintenance.TabPages.Count

tabpages do contains atleast one tab otherwise chage ur code like this...

if(tcitemmaintenance.tabpages <> nothing) then

while localcount <tcitemmaintenance.tabpages.count ... ur code

....................

end if

best of luck




Re: Windows Forms Designer works on VS2005 Machines and does not work on NON VS2005 machines

ChristianBG

i am sorry the msgbox i forgot was in there. i put that in there to make sure the error was coming from the tcItemMaintenance. i originally thought it was the tabPages collaction also the problem is trying to debug it. when i run in on any machine VS it works the tcItemMaintenance is created, there are 8 tabs in the collection. but needless to say the msg box is where the error happens now that was just a testing line of code. it is definitly the tcITemmaintenance Control.
Now what is happening. i did as u suggested and put in if tcitemmaint is nothing then block so it will skip that section of code, but as soon as it gets to the next control the same thing happens. the next control is a combobox it has the same nullreference error.
even though all these controls are added during design to time can i recreate them during runtime with causing duplicates and errors all over the place
Or is there something all together going on here i have never seen anything like this before.






Re: Windows Forms Designer works on VS2005 Machines and does not work on NON VS2005 machines

ChristianBG

After continuing to step throught the Code it appears as if the form.designer is being loaded becuase all the controls are returning null reference error.






Re: Windows Forms Designer works on VS2005 Machines and does not work on NON VS2005 machines

Pravin Chandankhede

if all controls are returing null... make sure the InitializeComponent method is called in the constructor

this seems to be strange problem....