DataGridView error when set DataSource
- by user264464
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