Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Conversion from C# to VB.NET
Message
De
17/04/2013 16:33:36
 
 
À
17/04/2013 14:38:37
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01571173
Message ID:
01571272
Vues:
34
Ok, here's my findings.

I created a temp version of Tables:
    Public Class TablesTemp
        Inherits System.Collections.Specialized.NameObjectCollectionBase

        Public Overloads Sub Add(ByVal Table As Table)
            BaseAdd(Table.Name, Table)
        End Sub

        Default Public Overloads ReadOnly Property Item(ByVal Title As String) As Table
            Get
                Return CType(BaseGet(Title), Table)
            End Get
        End Property

        Default Public Overloads ReadOnly Property Item(ByVal Index As Integer) As Table
            Get
                Return CType(BaseGet(Index), Table)
            End Get
        End Property

        ' Removes an entry with the specified key from the collection
        Public Sub Remove(ByVal tcKey As String)
            BaseRemove(tcKey)
        End Sub

        ' Removes an entry in the specified index from the collection
        Public Sub Remove(ByVal tnIndex As Integer)
            BaseRemoveAt(tnIndex)
        End Sub

        ' Removes everything
        Public Sub Clear()
            BaseClear()
        End Sub

    End Class
Then, I tried:
oApp.Tables = oApp.TablesTemp
This does not work as the designer is complaining:

"Value of type 'Framework.Framework.TablesTemp' cannot be converted to 'Framework.Framework.Tables'. "

So, I thought we are not able to assign a NameObjectCollectionBase object as is to another one. So, I implemented a cloneable interface to TablesTemp. I got:

"Unable to cast object of type 'Framework.Framework.TablesTemp' to type 'Framework.Framework.Tables'."

So, is this normal we cannot assign a NameObjectCollectionBase object to another one?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform