|
-
June 16th, 2001, 08:30 AM
#1
Select Case
I have a toolbar with print,save,open, and new. but when i use select case, and i click on the button that says "new" it prints. What's wrong?
--Ant
--------------------------------------------------
check out my newest freeware
E-mail me at: [email protected]
for the address
-
June 16th, 2001, 08:36 AM
#2
Re: Select Case
Your select Case choices are wrong or incomplete.
John G
-
June 16th, 2001, 02:32 PM
#3
Re: Select Case
How do you complete one?
--Ant
--------------------------------------------------
check out my newest freeware
E-mail me at: [email protected]
for the address
-
June 16th, 2001, 03:34 PM
#4
Re: Select Case
Make sure all the values you are looking for are in a Case statement. IF they are not and you have a "Case Else" then "Case Else" will catch any values passed to the Select statement that do not meet your criteria.
If you are still having problems with your Select, post the code so someone can find out what you are doing wrong.
John G
-
June 17th, 2001, 06:52 PM
#5
Re: Select Case
Inside the Toolbar Click event:
Select Case tool
Case new
Dim f as Form2
set f = new Form2
f.show
Case print
Dim text
text = Richtextbox1.text
Printer.print Text
Printer.enddoc
Case save
' and it goes on and on
Case else
Msgbox "What!?"
End Select
--Ant
--------------------------------------------------
check out my newest freeware
E-mail me at: [email protected]
for the address
-
June 17th, 2001, 11:09 PM
#6
Re: Select Case
hi
try this..
i think u have to give double quot for the passing string . i mean new,print...
Select Case tool
Case "new"
MsgBox "new"
Case "print"
MsgBox "print"
Case "save"
MsgBox "save"
Case Else
MsgBox "What!?"
End Select
-
June 18th, 2001, 09:49 AM
#7
Re: Select Case
A couple of suggested changes. Your select probably is not working because of the use or reserved words (ie print). I suspect you are using those words in your toolbuttons in which case it makes them strings. You need to encloise them in apostrophe's to use them as strings. Also when doing this you need to watch out for Upper/Lower case mixing. The lCase function will help in this regards.
private Sub Command1_Click()
Dim f as Form2 ' Moved
Select Case LCase(tool) ' Modified
Case "new" ' Modified
set f = new Form2
Dim text
text = Richtextbox1.text
Printer.print text
Printer.EndDoc
set f = nothing ' Added
Case "save" ' Modified
' and it goes on and on
Case else
MsgBox "What!?"
End Select
End Sub
John G
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
|