DomainClient c_client = (DomainClient)c_bindingSource.Current;
which results in an exception.
How can I get around this
Thanks in advance,
JackStri.
DomainClient c_client = (DomainClient)c_bindingSource.Current;
which results in an exception.
How can I get around this
Thanks in advance,
JackStri.
How do I create an object from a row in a DataGridView / BindingSource?
Lucia_fernadez
Hi,
I guess I replied more than year after you posted this.
I was facing the same problem, until I found this solution
DataRowView rowView = (DataRowView)empBindingSource.Current; ePCDataSet.empRow row = (ePCDataSet.empRow)rowView.Row;Regards,
Andi
StephenJr
Aaaaarrrgghh! I expected as much, but was hoping to get around it with less coding! Txs anyway.
JackStri.
AndrasEliassen
Remember that BindingSource, in your case, is binded to a DataSet. Therefore the current object would be a DataRow in the data set. You'll therefore need to conver the data row to your custom object using some method that you've written (maybe an overloaded constructor on the custom class or a static method).
DataRow row = (DataRow)c_bindingSource.Current;
DomainClient client = new DomainClient(row);
Michael Taylor - 11/2/06