Administrator

Administrator

  • Tech Writer
  • 2.2k
  • 1.5m

Accessor Problem!

Mar 1 2003 4:29 AM
i got this routine from Bhagvan Chougule (Thanks) and i need to convert from VB to C#. I dont know how because i never saw before a accessor routine with parameters in C#. The VB code: Public Property Field(ByVal strFieldName As String, Optional ByVal rowNum As Integer = 0) get Return objDataTable(tableNum -1).Rows(rowNum) (strFieldName) End Get Set (ByVal Value) objDataTable(tableNum -1).Rows(rowNum) (strFieldName) = Value End Set End Property and i convert it to : public string Field (string strFieldName, int rowNum) { get { return objDataTable(tableNum-1).Rows(rowNum)(strFieldName); } set { objDataTable(tableNum-1).Rows(rowNum)(strFieldName) = value; } } but i have an error on the get and the set, asking for ";" Help this newbie!

Answers (3)