我需要一些帮助将一些VB.NET代码转换为C#.我尝试了几个"代码转换器",但没有一个能给我一个可行的响应.
这是代码:
If Me.OrdersDataGridView.SelectedRows.Count > 0 Then Dim editForm As New Order(Me.NorthwindDataSet, _ Me.NorthwindDataSet.Orders.Rows.IndexOf_ (CType(CType(Me.OrdersDataGridView.SelectedRows(0)._ DataBoundItem, DataRowView).Row, NorthwindDataSet.OrdersRow))) editForm.Show() End If
非常感谢任何帮助!
编辑:这里是我发现的原始文章的链接.
试试这个:
if (this.OrdersDataGridView.SelectedRows.Count > 0) { NorthwindDataSet.OrdersRow row = (NorthwindDataSet.OrdersRow) ((DataRowView)this.OrdersDataGridView .SelectedRows(0).DataBoundIte).Row; Order editForm = new Order( this.NorthwindDataSet, this.NorthwindDataSet.Orders.Rows.IndexOf(row)); editForm.Show(); }