DataGridView error when set DataSource

Posted by user264464 on Stack Overflow See other posts from Stack Overflow or by user264464
Published on 2010-05-14T14:19:08Z Indexed on 2010/05/14 14:34 UTC
Read the original article Hit count: 199

Filed under:
|
|

I got an error when run datagridview.DataSource = dataView; dataview is correct. I can see data inside it when I debug program.

I got next error "Object reference not set to an instance of an object."

Any Ideas?

code:

this.datagridview = new System.Windows.Forms.DataGridView();

...

  DataSet ds = new DataSet();
  XmlReaderSettings settings = new XmlReaderSettings();
  StringReader stringReader = new StringReader(retString);
  XmlReader xmlReader = XmlReader.Create(stringReader, settings);
  ds.ReadXml(xmlReader);
  DataView dataView = ds.Tables[0].DefaultView;

dataView is not null. I am able to view it when debug

© Stack Overflow or respective owner

Related posts about .NET

Related posts about winforms