Plz tell me correct answer

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kashifabbasi786
    New Member
    • Sep 2008
    • 4

    Plz tell me correct answer

    I have the following code in vb.net,which work very fine,but i want to convert it in C#.net(which is also pasted below),But it it have error on "item" and on "Index"
    some one help me plz

    VB.Net Code
    Code:
    Default Public Shadows Property Item(ByVal Index As Integer) As ColumnBound
            Get
                Return CType(MyBase.Item(Index), ColumnBound)
            End Get
            Set(ByVal Value As ColumnBound)
                MyBase.Item(Index) = Value
            End Set
        End Property
    C#.Net Code
    Code:
    public new ColumnBound Item
        {
            get
            {
                return (ColumnBound)base.Item[Index];
            }
            set
            {
                base.Item[Index] = value;
            }
        }
    Last edited by kenobewan; Sep 27 '08, 12:50 PM. Reason: Use code tags
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    In vb you have the Index As Integer made available to the function. What is the value of index in your c# code?

    Comment

    • kashifabbasi786
      New Member
      • Sep 2008
      • 4

      #3
      Originally posted by kenobewan
      In vb you have the Index As Integer made available to the function. What is the value of index in your c# code?



      I have not given any value to Index in C#.thnx for reply
      if u find any solution than plz inform me

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Is that a class or a property? If it's a property, there is no "new" keyword.
        Code:
        public ColumnBound Item 
            { 
                get 
                { 
                    return (ColumnBound)base.Item[Index]; 
                } 
                set 
                { 
                    base.Item[Index] = value; 
                } 
            }
        However, you will need to have declared Index somewhere inside the class that has that property, so that the Item value can be retrieved.

        Comment

        Working...