question(s) about declaring variables



1st. Which is better for a variable that is going to be used for text. Letting a variable be a
variant or declaring it as a string. According to MSDN, variants are more "versatile" ( if I'm
reading it right. )

2nd. Why do all code examples use "As String to" declare each variable like this:
Dim var1 As String
Public var2 As String.

instead of using the $ type-declaration character like this:

Dim var1$
Public var2 $

3rd. Why a separate line for each variable

I realize that declaring them like this:
Dim var1, var2, var3 As String

makes var1 and var2 variants and only var3 is declared as a string.

when done this way however:

Dim var1$, var2$, var3$

They are all recognized as String variables.

Thus concludes my dumb question(s) for today.

tyia

--
Steve
95isalive
This site is best viewed............
........................with a computer


.



Relevant Pages

  • Re: Dont get Array value in textbox
    ... Public Sub UT(ByVal Segment As String, ByVal BD As, ByVal ... though there's little problem with declaring it as a Function. ... USPoPA_NpaNxx = Cells(adrsX, adrsY) ... Dim test As String ...
    (microsoft.public.vb.general.discussion)
  • Re: VB 2008: Option Strict On + Infer On at class level
    ... What does the compiler prevent from declaring x As String? ... Public Sub New ...
    (microsoft.public.dotnet.languages.vb)
  • Re: problem with function
    ... Hence any attempt to write into memory past the end of oldName would ... you are declaring newName inside the ... after oldName so the compiler is not warning you when you overwrite ... If you declare a dummy string just after oldName in your second ...
    (alt.comp.lang.learn.c-cpp)
  • Local Variables Passing info between classes etc.
    ... which passes it the input a string at a time. ... parseArticleMethod needs to return to get the next line of input, ... Declaring a set or array etc. inside the ParseArticle ... the set or array in the superclass might work, ...
    (comp.lang.java.help)
  • Re: Working with floating point numbers.
    ... Some languages let you do this sort of thing by declaring two variables ... at the same address - e.g. a Double and an 8-byte array of Char. ... S As String * 4 ... Dim S As MyStrings ...
    (microsoft.public.access.modulesdaovba)