Problem with addition layers to map collection

Topics: General Topics
May 24, 2007 at 1:23 AM
Hi all.
I have this code:
System::String^ ConnStr = "Server=wega-pc;Port=5432;User Id=postgres;Password=<...>;Database=<...>;";
SharpMap::Layers::VectorLayer^ myLayer =
gcnew SharpMap::Layers::VectorLayer("Mine");

myLayer->DataSource = gcnew SharpMap::Data::Providers::PostGIS(ConnStr,"gtest", "geom", "id");
myLayer->Style->Fill = gcnew SolidBrush(Color::Green);
//Set up styles
myLayer->Style->Outline = gcnew Pen(Color::Magenta, 3.f);
myLayer->Style->EnableOutline = true;

I get the error "Object reference not set to an instance of an object." after performing last string
Could you help me? Why do I get this error?

Sorry for my English
Jun 19, 2007 at 8:54 AM
Do you also have a line like this:

myControl->Map = gcnew SharpMap::Map();