|
-
January 12th, 2000, 01:34 PM
#1
How to declare(Dim) a string array
Hi,
I am new to VB, I do not know how to declare string array.
I tried:
Dim Names As String[]
it giving error.
Can anybody tell me how to declare a string array in VB.
Thanks,
vasu
-
January 12th, 2000, 01:47 PM
#2
Re: How to declare(Dim) a string array
You can either use
dim string(<the number> as string
or
dim string() as string
and redim it later
redim string(<the number> as string
good luck
Leo
-
January 12th, 2000, 02:03 PM
#3
Re: How to declare(Dim) a string array
Thanks Leo.
But one question:
I declare as Names() As String
But how do I know how many elements are there in the Names array at runtime?
My actual requirement is:
I will have method like GetNames which will take String array as an argument.
This method will be in a DLL.
My client will call this method passing an array.
Now my DLL method should determine(at runtime) how many elements are there and should print out those names.
How can I do this.
Sorry for troubling u.
Thanks,
Vasu
-
January 12th, 2000, 02:25 PM
#4
Re: How to declare(Dim) a string array
In this case you can guess the largest number that you think user would enter. Since it’s DLL, I assume that “GetString†will accrue while program is running only and after that you can just free the string array and start from the beginning.
Are you going to pass these arrays into a database or a text file later on? You can reset It after “update†or “close†statement..
Leo
-
January 13th, 2000, 06:23 AM
#5
Re: How to declare(Dim) a string array
Dim Names() as String is the syntax
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|