Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 04-11-2007, 06:04 AM   #1 (permalink)
wolf99
Code Monkey
 
wolf99's Avatar
 
Join Date: Jan 2006
Location: in college (again) in rural Eire
Posts: 45
wolf99 is on a distinguished road
another VB6 Noob Q: fill array at declaration

Hi

In case you didnt see my last post I am a total noob to VB (as in havnt got much of a clue) and would really appreciate a quick tip on this one.

I am delcaring a array, "lookUp"

Code:
Dim lookUp() As String
and would like to populate the array at this point so tried

Code:
Dim lookUp() As String '= New String(){"1", "2", "3"}
but no joy. I tried messing around with several combinations of this but still nothing
Is this possible to do in VBsix? (just found out char does not exist so am beginning to doubt a lot of things )
thanks
wolf99 is offline   Reply With Quote
Old 05-08-2007, 02:38 PM   #2 (permalink)
Valmont
[code][/code] enforcer
 
Valmont's Avatar
 
Join Date: Mar 2003
Location: Netherlands
Posts: 1,544
Valmont is on a distinguished road
Stop trying because you can't in - VB 6.

Filling an array at declaration time is called initializing.
Initializing arrays is supported by the newer VB .NET and .NET 2.0 only.
__________________
Valmont is offline   Reply With Quote
Old 07-17-2007, 01:11 PM   #3 (permalink)
cspoon
Recruit
 
Join Date: Jul 2007
Posts: 2
cspoon is on a distinguished road
Post is a bit old, but Ill throw in 2c (if it helps).
You can't fill at declaration, but Form_Load should be as effective unless
you dont have a form..

Dim myString(1 To 3) As String

Private Sub Form_Load()
myString(1) = "blah1"
myString(2) = "blah2"
myString(3) = "blah3"
End Sub

If you dont need to change the values, you could try constants (not an array) ;

Private Enum myInt
one& = 1
two& = 2
three& = 500
End Enum

myInt.one would return 1.

hth
cspoon is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
creating 3-dimensional array nesvarbu Platform/API C++ 3 05-09-2006 07:01 AM
Include file shown correctly in FF not in IE Stoner HTML, XML, Javascript, AJAX 2 04-21-2006 07:56 AM
Simple reverse programm silex Standard C, C++ 3 01-22-2005 08:03 AM


All times are GMT -8. The time now is 07:16 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting