Hi, i am converting VB to c # using dev express. I am getting few errors as follows.
VB code 1:
Dim img As HtmlImage = Nothing
img = grdview.FindRowCellTemplateControl(e.VisibleIndex, grdview.Columns("x"), "y")
c# code 1:
HtmlImage img = null;
img = grdview.FindRowCellTemplateControl(e.VisibleIndex, grdview.Columns["x"], "y");
error 1: the best overloaded method match has some invalid arguements
VB code 2:
Dim values As Object() = grdview.GetRowValuesByKeyValue(e.KeyValue, New String() {"a", "b"})
c# code 2:
object[] values = grdview.GetRowValuesByKeyValue(e.KeyValue, new string[] {"a", "b"});
error 2: cannot implicity convert type object to object[]. An explicit conversion exists(are you missing a cast)?
VB code 3:
Dim values() As String = e.Parameters.Split(",")
c# code 3:
string[] values = e.Parameters.Split(",");
error 3: the best overload method match for string.split(params char[]) has some invalid arguments
VB CODE 4:
If Not e.Column.GetType Is GetType(DevExpress.Web.ASPxGridView.GridViewDataTextColumn) Then
Exit Sub
C # CODE 4:
if (!(e.Column.GetType == typeof(DevExpress.Web.ASPxGridView.GridViewDataTextColumn)))
{
return;
}
ERROR 4: operator ==cannot be applied to operands of type 'method group' ans 'system.type'.
vb code 5:
e.Row.ToolTip = "Ext." & s(0).ToString
If Not s(1).ToString = String.Empty Then
e.Row.ToolTip &= "; sample = " & s(1).ToString
End If
c code 5:
e.Row.ToolTip = ("Ext." + s[0].ToString);
if (!(s[1].ToString == String.Empty))
{
("; sample = " + s[1].ToString);
}
error 5: operator ==cannot be applied to operands of type 'method group' to string
operator + cannot be applied to operands of type 'string' and 'method group'
How to convert these lines to C SHARP:
Private Sub BindGridDropsDowns()
With CType(grdExtList.Columns("Title"), DevExpress.Web.ASPxGridView.GridViewDataComboBoxColumn)
Dim ds As DataSet = grdExtList.DataSource 'GetExtensionListDS()
If Not ds Is Nothing AndAlso ds.Tables.Count > 0 Then
ds.Tables(0).DefaultView.RowFilter = ""
Dim dv As DataView = ds.Tables(0).DefaultView
dv.Sort = "Title"
Dim dt As DataTable
dt = dv.ToTable("Titles", True, New String() {"Title"})
Dim row As DataRow = dt.NewRow()
row.Item("Title") = ""
dt.Rows.InsertAt(row, 0)
.PropertiesComboBox.DataSource = dt
.PropertiesComboBox.TextField = "Title"
.PropertiesComboBox.ValueField = "Title"
End If
End With
and below line convert to c sharp
Dim row As DataRow = dt.NewRow()
row.Item("Title") = ""
c#
DataRow row = dt.NewRow();
row.Item["Title"] = "";
error: system.data.datarow does not contain definiton for "item' and no extension method 'item' accepting first arguement of type system.data.datarow