none
Snippet problem RRS feed

  • Question

  • Hi
    Why this Snippet works in VB

            Dim row1 As NorthwindDataSet.CustomersRow
            row1 = CType(CType(Me.CustomersBindingSource.Current, DataRowView).Row, NorthwindDataSet.CustomersRow)

    And this one does not work in C#

                NorthwindDataSet.CustomersRow row;
                row = ((NorthwindDataSet.CustomersRow)(DataRowView)this.CustomersBindingSource.Current);

    I receive this error

    Cannot convert type 'System.Data.DataRowView' to 'WindowsFormsApplication1.NorthwindDataSet.CustomersRow'  


    Thanks for your help

    Thursday, April 10, 2008 11:08 PM

Answers

  • I did translation of your VB code on this page and here is the result:

        NorthwindDataSet.CustomersRow row1;
        row1 = (NorthwindDataSet.CustomersRow)((DataRowView)this.CustomersBindingSource.Current).Row;

    Thursday, April 10, 2008 11:14 PM
  • Thanks it work perfectly.

     

     

    Friday, April 11, 2008 12:07 AM

All replies

  • I did translation of your VB code on this page and here is the result:

        NorthwindDataSet.CustomersRow row1;
        row1 = (NorthwindDataSet.CustomersRow)((DataRowView)this.CustomersBindingSource.Current).Row;

    Thursday, April 10, 2008 11:14 PM
  • Thanks it work perfectly.

     

     

    Friday, April 11, 2008 12:07 AM