Results 1 to 4 of 4

Thread: Delare & initialise var at same time

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2000
    Location
    London
    Posts
    290
    Is this possible?
    I have a line

    Public temp_new_CmbTitle As String

    and what i`d like is something like

    Public temp_new_CmbTitle As String = "0"

    is this possible?

    a.


  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    In a word NO!

    This was one of my gripes when I first started with VB

    The best you can do is:

    Public temp_new_CmbTitle As String: temp_new_CmbTitle = "0"

    Mark
    -------------------

  3. #3
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221
    Const temp_new_CmbTitle As String ="0"

    I almost know that this isn't what you are looking for. Because you cant change any constants. But this is that one line thing you were asking for....

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2000
    Location
    London
    Posts
    290
    Er, yeah, a const is no good in this case. (Cos i need to have a default value, as i`m comparing against data from a db, and i get an error if i compare a zero with a null).

    I`m glad its not just me it annoyed. I cant think of a reason that this was done as a design decision. Maybe to force you to use consts instead of vars? But i cant have them as consts, can I ?!

    While i`m moaning, does anyone else (reading this thread, not worth starting a new one) get this bug where one of the forms (in the project explorer window) gets highlighted when you select it, and for the rest of your session it remains highlighted - you can still select other forms to edit with right-mouse/view code, but the highlight moves back to the originally highlighted form?

    Thanks anyway!

    Alex.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width