Nevron Forum
Home
»
Nevron Vision for NET
»
Nevron User Interface for .NET
NullReferenceException While Intializing NExplorerBar
https://www.nevron.com/Forum/Topic4103.aspx
By Eshar Gal
-
Wednesday, September 1, 2010
Maybe I'm just doing something wrong, I have no idea.
/////////////////////////////////////////////////////////////////////////////
var rates = from rate in MainForm.readData.Rates
orderby rate.ValidFrom descending
select rate;
int counter = 1;
foreach (CViwer.Rate row in rates)
{
NBand band ;
NExplorerBar explorerBar = new NExplorerBar();//NullReferenceException
Console.WriteLine(counter.ToString());
counter++;
bool yearExists = false;
foreach (Control c in panelBar.Controls)
{
NBand cBand = (NBand)c;
if (cBand.Caption == row.ValidFrom.Year.ToString())
{
band = cBand;
explorerBar = (NExplorerBar)band.Tag;
yearExists = true;
break;
}
}
if (!yearExists)
{
band = new NBand();
band.Caption = row.ValidFrom.Year.ToString();
band.TextAlign = HorizontalAlignment.Center;
panelBar.Controls.Add(band);
explorerBar = new NExplorerBar();
explorerBar.Dock = DockStyle.Fill;
band.Controls.Add(explorerBar);
band.Tag = explorerBar;
}
NExpander nexpender = new NExpander();
nexpender.Text = "Expander " + row.Id.ToString();
Rates ratesForm = new Rates();
nexpender.Height = ratesForm.Height + 35;
ratesForm.Location = new Point(0, 30);
nexpender.Controls.Add(ratesForm);
nexpender.State = ExpanderState.Collapsed;
explorerBar.Controls.Add(nexpender);
}
}
A first chance exception of type 'System.NullReferenceException' occurred in Nevron.Presentation.dll
System.Transactions Critical: 0 :
http://msdn.microsoft.com/TraceCodes/System/ActivityTracing/2004/07/Reliability/Exception/Unhandled
Unhandled exception
CViwer.vshost.exe
System.NullReferenceException, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
Object reference not set to an instance of an object.
at Nevron.UI.WinForm.Controls.NSkinManager.lIIIll111()
at Nevron.UI.WinForm.Controls.NSkinManager.UnregisterSkinnableInstance(INSkinnableControl control)
at Nevron.UI.WinForm.Controls.NExplorerBar.PerformDispose(Boolean disposing)
at Nevron.UI.WinForm.NControl.Dispose(Boolean disposing)
at System.ComponentModel.Component.Finalize()
System.NullReferenceException: Object reference not set to an instance of an object.
at Nevron.UI.WinForm.Controls.NSkinManager.lIIIll111()
at Nevron.UI.WinForm.Controls.NSkinManager.UnregisterSkinnableInstance(INSkinnableControl control)
at Nevron.UI.WinForm.Controls.NExplorerBar.PerformDispose(Boolean disposing)
at Nevron.UI.WinForm.NControl.Dispose(Boolean disposing)
at System.ComponentModel.Component.Finalize()
/////////////////////////////////////////////////////////////////////////////
It will happen every time at a different spot anywhere after 200 as far as i can see.
By Nevron Support
-
Thursday, September 2, 2010
Hello Eshar,
Do you receive this error if there is no skin applied?
By Eshar Gal
-
Thursday, September 2, 2010
Hi,
Not sure if i know how to do this, what i was doing is adding NSkinManager.Instance.Enabled = false; Something did changed, I'm getting some native code pointer exception now or it will just crush.
To be honest, I'm not sure if i really want to pull 500 controls on the form. It is just something I'm playing around with and was wondering maybe I was doing something wrong.
Thanks.