Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need recommendation on weird behavior
Message
De
07/06/2006 01:08:01
 
 
À
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Need recommendation on weird behavior
Versions des environnements
Environment:
VB 8.0
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01127533
Message ID:
01127533
Vues:
58
Hi Cetin

Today, you helped me with a great design to improve my Inlist() function. The result was as follow:
    ' VFP inlist equivalent
    ' expO1 Item where all the items will be tried to look into
    ' expO2 Param array for a list of items
    Public Function Inlist(ByVal toItem As IComparable, ByVal ParamArray toItems() As IComparable) As Boolean
        Return Array.IndexOf(toItems, toItem) <> -1
    End Function
Tonight, I found something strange. I have the following code:
        If oApp.Inlist(loRow("Type"), 1, 3) Then
            cHtml = cHtml + "313"
        Else
            cHtml = cHtml + "405"
        End If
The value of loRow("Type") is 3. I also show it by adding a line just before the condition and it is in fact showing 3. But, it goes in the 405 condition. If I change to this:
        If oApp.Inlist(3, 1, 3) Then
            cHtml = cHtml + "313"
        Else
            cHtml = cHtml + "405"
        End If
It works as expected. Can you see something that could be in effect here to obtain that weird behavior when using a datarow?

If I do this:
        If oApp.Inlist(CType(loRow("Type"), System.Int32), 1, 3) Then
            cHtml = cHtml + "313"
        Else
            cHtml = cHtml + "405"
        End If
It works as expected. But, I don't want to be forced to make that conversion everytime I want to verify for numeric values in Inlist(). The field Type is of Numeric 1 from a VFP table.
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform