Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Use of variable prior to assignment in VB 2005
Message
De
12/06/2007 21:24:57
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, États-Unis
 
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Divers
Thread ID:
01232383
Message ID:
01232476
Vues:
13
Hmmm... I don't have VS on this machine, but I'm sure that would work. I always thought that it was a bad practice to set your variable to nothing upon declaration.

>Which line is showing the green squiggly?
>
>have you tried:
>
Dim myHistoricalRatesDS As HistoricalRatesDS = nothing
>>I keep getting a lot of "Use of variable prior to assignment" warnings in VB 2005. I know that I can turn them off at the project level and usually do this, but it makes me suspicious that maybe I am doing something that I shouldn't. Here is a snippet in a business class:
>>
>>
>>    Public Function LoadHistoricalRates() As HistoricalRatesDS
>>
>>        'This is my data access class...
>>        Dim myHistoricalRatesData As New HistoricalRatesData
>>        'This is my dataset.  I don't instantiate it here because it is instantiated
>>        'in my data access class...
>>        Dim myHistoricalRatesDS As HistoricalRatesDS
>>
>>        'An instance of HistoricalRatesDS is instantiated in my data access
>>        'class so I don't instantiate it again...
>>        myHistoricalRatesDS = myHistoricalRatesData.LoadHistoricalRates
>>
>>        'Here is where I get the warning...
>>        Return myHistoricalRatesDS
>>
>>    End Function
>>
Very fitting: http://xkcd.com/386/
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform