Karim Saikali,
My apologies if this sounds rude - I'm presuming that you have academic curiosity, and that this is not an on-line test type question...
This link might help:
Dim Statement (Visual Basic) From what I can see in the Microsoft documentation, none of those forms should work. Did you try testing anything?
Of course, it is possible that the VBA compiler syntax has been extended, so - I'm guessing a little bit, but here are my thoughts:
- CultFr is type CultureInfo, and initialised.
- Cult_frFR is a variant (it can be any type), and is initialised with a CultureInfo.
- Cult_fr1 is type CultureInfo, and initialised. May be that Cult_fr1 cannot be assigned, I do not have the ability to test this right now.
Testing this should be trivially easy, assuming that you have any of the uSloth office tools. Just open the code browser and run a few tests.
This is a test script that I would try:
-
''--first test is if this even compiles...
-
-
''--variable construction
-
Dim CultFr As CultureInfo = New CultureInfo("fr-FR")
-
Dim Cult_frFR = New CultureInfo("fr-FR")
-
Dim Cult_fr1 As New CultureInfo("fr-FR")
-
-
''--test for assignability
-
Set CultFr = New CultureInfo("fr-FR")
-
Set Cult_frFR = New CultureInfo("fr-FR")
-
Set Cult_fr1 = New CultureInfo("fr-FR")
-
-
''--test for Null'ability
-
''--May need to use Nothing in place of Null; please update appropriately.
-
''-- Choice of Null versus Nothing has everything to do with primitive values versus objekts.
-
Set CultFr = Null
-
Set Cult_frFR = Null
-
Set Cult_fr1 = Null
-
-
''--test for type restriction by assigning a date
-
CultFr = #1/13/2004#
-
Cult_frFR = #1/13/2004#
-
Cult_fr1 = #1/13/2004#
-
-
''--test for sub-class assignment
-
Set CultFr = New SubclassOfCultureInfo("fr-FR")
-
Set Cult_frFR = New SubclassOfCultureInfo("fr-FR")
-
Set Cult_fr1 = New SubclassOfCultureInfo("fr-FR")
-
I am curious as to how the statements do differ.
Will you please run the tests and let us know what you find?
Luck!
Oralloy