I’m using/building Scintilla.NET and switched the project to .NET 2.0 for compatibility issues.
It works, but when I click the new tab button I get an error which says:
Object reference not set to an
instance of an object.
The problem occurs in this code:
ScintillaNet.Scintilla currentScin;
Stream Stream1;
public List <ScintillaNet.Scintilla> ScinList;
//Code for various events
private void New_Click(object sender, EventArgs e)
{
TabPage tabp = new TabPage();
ScintillaNet.Scintilla scin = new ScintillaNet.Scintilla();
scin.Dock = DockStyle.Fill;
scin.Margins[0].Width = 20;
scin.ConfigurationManager.CustomLocation = "My Styles";
scin.ConfigurationManager.Language = "lua";
scin.Parent = tabp;
// This line throws "Object reference not set to an instance of an object."
ScinList.Add(scin);
tabControl1.TabPages.Add(tabp);
}
The problem is that you have not initialized
ScinList. Fields of a class are initialized to their default value, which in this case isnull.You need to initialize it somewhere, either where it is declared…
… or in the constructor …
If this line actually does appear in your code, please edit your question with the code that does so.