473,480 Members | 1,964 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Select... Case Array Question

Hi

If i am using a Select... Case is there any way to have the elements
of an array tested within a case, for example:

Dim MyChar as Char
Select Case MyChar
Case "a"c, "b"c, "c"c
'Do Something
End Select
Would something like this be possible:

Dim MyChar as Char
Dim testChars() as Char = {"a"c, "b"c, "c"c}
Select Case MyChar
CasetestChars
'Do Something
End Select

cheers

Blu

Nov 20 '05 #1
6 5003
"BluDog" <ne**@nospam.bludog.net> wrote in message
news:lv********************************@4ax.com...
Would something like this be possible:

Dim MyChar as Char
Dim testChars() as Char = {"a"c, "b"c, "c"c}
Select Case MyChar
CasetestChars
'Do Something
End Select

cheers

Blu


Nope. Whatever follows "Case" needs to be something the compiler can
resolve, i.e. a const, enum or literal value. A variable won't git it since
that is a runtime value. (there is probably a more technically correct way
to say that!)

Best Regards,

Andy
Nov 20 '05 #2
"Andy Becker" <x@x.com> wrote in message
news:O3**************@tk2msftngp13.phx.gbl...

Nope. Whatever follows "Case" needs to be something the compiler can
resolve, i.e. a const, enum or literal value. A variable won't git it since that is a runtime value. (there is probably a more technically correct way to say that!)


I tried this today but couldn't make it work:
(pseudo code, don't know if syntax is correct

Select Case Messagebox.Show("message",,DialogButtonsOKYesNo)
Case DialogButtonYes
code
Case DialogbuttonNo
code
End Case

Can anyone explain why that doesn't work?
Nov 20 '05 #3
Ricky,

I do not know why it is not working, this code works for me.

Select Case MessageBox.Show("messagebox", _
"", MessageBoxButtons.YesNo)
Case DialogResult.Yes
MessageBox.Show("Yes")
Case DialogResult.No
MessageBox.Show("No")
End Select

So I am curious why this works not for you?

Cor
Nov 20 '05 #4
"Cor Ligthert" <no**********@planet.nl> wrote in message
news:OU**************@TK2MSFTNGP11.phx.gbl...
Ricky,

I do not know why it is not working, this code works for me.

Select Case MessageBox.Show("messagebox", _
"", MessageBoxButtons.YesNo)
Case DialogResult.Yes
MessageBox.Show("Yes")
Case DialogResult.No
MessageBox.Show("No")
End Select

So I am curious why this works not for you?


I'm not sure. I didn't fool with it long before just going with an If. I'll
try it again. Thanks.
Nov 20 '05 #5
* "Ricky W. Hunt" <rh*****@hotmail.com> scripsit:
Nope. Whatever follows "Case" needs to be something the compiler can
resolve, i.e. a const, enum or literal value. A variable won't git it since
that is a runtime value. (there is probably a more technically correct

way
to say that!)


I tried this today but couldn't make it work:
(pseudo code, don't know if syntax is correct

Select Case Messagebox.Show("message",,DialogButtonsOKYesNo)
Case DialogButtonYes


'DialogResult.Yes'.
code
Case DialogbuttonNo


'DialogResult.No'.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 20 '05 #6
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:uk**************@tk2msftngp13.phx.gbl...
* "Ricky W. Hunt" <rh*****@hotmail.com> scripsit:
Nope. Whatever follows "Case" needs to be something the compiler can
resolve, i.e. a const, enum or literal value. A variable won't git it

since
that is a runtime value. (there is probably a more technically correct

way
to say that!)


I tried this today but couldn't make it work:
(pseudo code, don't know if syntax is correct

Select Case Messagebox.Show("message",,DialogButtonsOKYesNo)
Case DialogButtonYes


'DialogResult.Yes'.


That's what I had. It was probably some other syntax problem. I was in a
hurry and needed to get it out. I'll try it again tonight. Thanks.
Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5178
by: Mohammed Mazid | last post by:
Hi folks! Can anyone please help me with this? I am developing a Quiz program but I am stuck with "multiple answers". Basically I need some sort of code that would select multiple answers...
1
3919
by: Cooper | last post by:
Hello, I have definited two select: main, secondary main = 0, 1, 2 secondaryA = "a", "b", "c" secondaryB = "1", "2", "3" secondaryC = "5", "6", "15", "25" i want that, if i check from...
4
6412
by: point | last post by:
Hello there... I'm a PHP programmer and starting to learn JS... I have a following problem.... I have 3 select boxes! one is hotel one is destination and one is country... if someone...
2
1278
by: James | last post by:
i wrote a filewatcher application and inside the code, i've a select case statement : Private Sub FileSystemWatcher1_Created(ByVal sender As Object, ByVal e As System.IO.FileSystemEventArgs)...
4
6660
by: Michel | last post by:
Hi, How can I use then Windows' color picker from Access? Thx
14
2222
by: aa | last post by:
Code like this ======================= Select case q Case "a" Dim arr(5) Case "b" Dim arr(2) end select ===================== returns an error saying variable arr redefined.
5
3284
by: Max | last post by:
Is there any way to set a select-multiple type <select multiple="multiple"with multiple selected options in scripting? Any idea about this is appreciative.
25
5360
by: bonneylake | last post by:
Hey Everyone, Well i am not sure if my question needs to be here or in coldfusion. If i have my question is in the wrong section i am sorry in advance an will move it to the correct section. ...
4
10645
tjc0ol
by: tjc0ol | last post by:
Hi guys, I'm a newbie in php and I got error in my index.php which is: 1054 - Unknown column 'p.products_id' in 'on clause' select p.products_image, pd.products_name, p.products_id,...
0
7049
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
6912
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...
0
7052
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
6981
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5348
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4790
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4488
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3000
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.