473,387 Members | 1,664 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

constant string array

553 512MB
Hi

How to declare a constant array variable of String type in VB/VBA

I've tried doing many things like this bt doesn't work

Const constStrArry() As String = ("string1"), ("string2")

with every similar method, i get error

is it possible to declare constant string array at all in VB?
Aug 13 '07 #1
4 10444
ADezii
8,834 Expert 8TB
Hi

How to declare a constant array variable of String type in VB/VBA

I've tried doing many things like this bt doesn't work

Const constStrArry() As String = ("string1"), ("string2")

with every similar method, i get error

is it possible to declare constant string array at all in VB?
The concept behind a Constants is that they can be used in place of Literal Values and you set them equal to an expression, the expression being a Literal, other Constant, or any combination that includes all arithmetic or logical operators except Is. To the best of my knowledge, you cannot Declare a Constant as any type of an Array. Why would you even attempt something like this? What are you trying to accomplish?
Aug 13 '07 #2
questionit
553 512MB
I understand what you mean.

While doing some example, i came across that idea.. What if you need to check something against many values - Values belonged to same thing (same variable) . In that case, i would need an array constant.

I mean there is n orestriction the scenarious!

would you recommend using Enum instead in this case?

The concept behind a Constants is that they can be used in place of Literal Values and you set them equal to an expression, the expression being a Literal, other Constant, or any combination that includes all arithmetic or logical operators except Is. To the best of my knowledge, you cannot Declare a Constant as any type of an Array. Why would you even attempt something like this? What are you trying to accomplish?
Aug 13 '07 #3
ADezii
8,834 Expert 8TB
I understand what you mean.

While doing some example, i came across that idea.. What if you need to check something against many values - Values belonged to same thing (same variable) . In that case, i would need an array constant.

I mean there is n orestriction the scenarious!

would you recommend using Enum instead in this case?
Give me a solid, concrete, example of what you are referring to.
Aug 13 '07 #4
questionit
553 512MB
Adezii

will come back to you on this one later as i am confused here a little bit.

VB Enums dont even take string values !

Thanks


Give me a solid, concrete, example of what you are referring to.
Aug 14 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Kyle | last post by:
Hi, Is it possible to initialize a constant memeber array in a class? I tried several syntax but all failed. class A { public: A(); ~A(); private:
8
by: Jeff Johnson | last post by:
Hi, I've begun converting an ASP site over to .NET and I'm a novice at both the new platform as well as C#. I have a COM+ object that returns a string array when it is called. The size of...
0
by: Christine | last post by:
I have a string array of decimal numbers and I would like to be able to multiply each item of the array by a constant, is there a way to convert string to a data type that will allow this?
11
by: Zordiac | last post by:
How do I dynamically populate a string array? I hope there is something obvious that I'm missing here Option Strict On dim s() as string dim sTmp as string = "test" dim i as integer ...
5
by: Paulers | last post by:
Hello all, I have a string array with duplicate elements. I need to create a new string array containing only the unique elements. Is there an easy way to do this? I have tried looping through...
3
by: jerico | last post by:
Hi.I have some confusion regarding a constant string and constant pointer to a string. char *str="hello"; Here I think "hello" is constant so we cant modify it.Then what about const char...
23
by: =?iso-8859-1?q?Santiago_Urue=F1a?= | last post by:
Hi, I tried to return a pointer to a constant string, but the compiler gives the following warning if a cast is not used: warning: assignment from incompatible pointer type This is the code:
13
by: sinbad | last post by:
hi, how to concatenate a "hash defined" constant value to another "hash defined" constant string. For example #define ABC 100 #define MYSTR "The value of ABC is" Now i need a string that...
5
by: Dbarten1982 | last post by:
I am brand new to C++ programming, and am completely stuck on a program. In the program I am supposed to create a string array that stores 5 user input words, and the string constant "END_OF_ARRAY'...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.