-
Feb 8th, 2005, 01:11 PM
#1
Thread Starter
Addicted Member
Help with Case statements [RESOLVED]
I am trying to dbl_click on a Treeview and have it work kind of like a menu, Its doing what its supposed to upto the Case statement.
My thought was to use the case statment to do things like open forms, etc... but it doesnt seem to work as I thought.
Is this an inappropriate use of Case? or am I just not coding it correctly?
VB Code:
Dim Selected
Dim tempArray() As String
tempArray = Split(TreeView1.SelectedItem.Text, " ") 'remove the space and store each word in an array
Selected = Join(tempArray, "") 'join back together again
Select Case Selected
Case NewPatient
FrameNewPatient.visible = true
Case EditPatien
MsgBox "NO"
End Sub
What I thought was that since Select Case is selecting my Selected variable
Then of the Selected happens to be = to NewPatient
that Case NewPatient would be triggerd and the code under it.
Last edited by DKasler; Feb 8th, 2005 at 01:34 PM.
Reason: Issue Resolved
-----MY SITES-----
BayRidgeNights.Com - NYC Nightlife Forums
Fight Communism - Rate Posts!
-
Feb 8th, 2005, 01:21 PM
#2
Fanatic Member
Re: Help with Case statements
Here's to us!
Who's like us?
Darned few, and they're all dead!
-
Feb 8th, 2005, 01:22 PM
#3
Addicted Member
Re: Help with Case statements
If I'm getting you correctly, you're trying to check the contents of a string. You need to enclose NewPatient and EditPatient in quotes, like this: "NewPatient", "EditPatient". I don't understand why would you want to remove the spaces either. BTW, you need a "End Select" after the whole statement.
-
Feb 8th, 2005, 01:34 PM
#4
Thread Starter
Addicted Member
Re: Help with Case statements
Thank you both.
Adding quotes as you suggested fixed my problem.
As for the question about striping the spaces, that was something I was toying with before I tried the whole case statement idea, and I just removed it.
Thanks guys.
-----MY SITES-----
BayRidgeNights.Com - NYC Nightlife Forums
Fight Communism - Rate Posts!
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
|