I am looking for an accurate conversion of this C# Linq code to VB.net. I have tried a number of tools to convert the C# to VB, but none of the VB converted statements return the correct results.
C#
var rows = GridView1.Rows.Cast<GridViewRow>().Where(a => a != row).ToList();
VB.net
Dim rows = GridView1.Rows.Cast(Of GridViewRow)().Where(Function(a) a IsNot row).ToList()
The process is suppose to select the rows of a Gridview, excluding the row selected by a click.
All rows are return, no row is excluded…
C#
Button btnUp = (Button)sender;
GridViewRow row = (GridViewRow)btnUp.NamingContainer;
// Get all items except the one selected
var rows = GridView1.Rows.Cast<GridViewRow>().Where(a => a != row).ToList();
VB.net
Dim btnUp As Button = DirectCast(sender, Button)
Dim row As GridViewRow = DirectCast(btnUp.NamingContainer, GridViewRow)
' Get all items except the one selected
Dim rows = GridView1.Rows.Cast(Of GridViewRow)().Where(Function(a) a IsNot row).ToList()
Thanks for any and all help.
Try this: