VBScript if button pressed...then - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Microsoft Windows and Software
Click Here to Login
Closed Thread
 
Thread Tools Display Modes
 
Old 12-06-2006, 07:49 PM   #1 (permalink)
Super Techie
 
Join Date: Jun 2006
Posts: 489
Default VBScript if button pressed...then

how would I do something like this

MsgBox"do you like pie?", 1, "Question"
*******something would go here to make it do this if "yes" is pressed: MsgBox"pie is good"

and something like this:MsgBox"why not?" if no is pressed


I know this is possible, but I can't get it to work also, can you do the same thing with InputBox?
__________________

__________________
Torvalds was contemptuous of Microsoft's claims and has asked Redmond to name the patent infringements so that their veracity can be challenged and workarounds found.
"Naming them would either make it clear that Linux is not infringing at all (which is quite possible, especially if the patents are bad), or would make it possible to avoid infringing by coding around whatever silly thing they claim,"

"So the whole 'We have a list and we're not telling you' should tell you something. Don't you think that if Microsoft actually had some really foolproof patent, they'd just tell us and go, 'nyaah, nyaah, nyaah!'?"

whole story here: http://www.vnunet.com/vnunet/news/21...-microsoft-put
kpmwrestler is offline  
Old 12-06-2006, 09:54 PM   #2 (permalink)
Wizard Techie
 
Join Date: Apr 2004
Posts: 3,247
Default

well, you could do a button, txt entry, whatever. really depends. easiest is say one button was pushed it would be somethng like

msgbox ("blah blah blah")
end sub

or for text box you could have seomthing like
'we will say we called you texty box info

option explicit

DIM valhold as string

valhold=val.info.txt

if valhold = ("yes") then
msgbox "blah blah blah"
else
msgbox "blah blah blah"
end if

end sub


You could also add some error checking, like to make sure a value is only yes or no, if it is something else then you present another msgbox stating to only enter yes or no. I may be off on some of my entries there, haven't used vb in awhile and its hard to without the editor auto entering/checking stuff for me.
__________________

__________________
If you argue with an idiot he will drag you down to his level and beat you with experience.

I am not a fast writer.
I am not a slow writer.
I am a half-fast writer.

-Robert Asprin
killians45 is offline  
Old 12-07-2006, 05:56 PM   #3 (permalink)
Super Techie
 
Join Date: Jun 2006
Posts: 489
Default

sorry, I meant if there was a box with yes or no (or any two buttons actually) and if the person clicks one, I know that the script can give a return value. is there a way to say if there is a certain return value, to do something?
__________________
Torvalds was contemptuous of Microsoft's claims and has asked Redmond to name the patent infringements so that their veracity can be challenged and workarounds found.
"Naming them would either make it clear that Linux is not infringing at all (which is quite possible, especially if the patents are bad), or would make it possible to avoid infringing by coding around whatever silly thing they claim,"

"So the whole 'We have a list and we're not telling you' should tell you something. Don't you think that if Microsoft actually had some really foolproof patent, they'd just tell us and go, 'nyaah, nyaah, nyaah!'?"

whole story here: http://www.vnunet.com/vnunet/news/21...-microsoft-put
kpmwrestler is offline  
Old 12-07-2006, 07:51 PM   #4 (permalink)
Wizard Techie
 
Join Date: Apr 2004
Posts: 3,247
Default

well, you could do a nested if then statement, but the best thing to do instead of that is do a case select. Just create a global variable that takes the value of the text box and assigns it to said variable, then create a select case that performs an action according to what the value is.
__________________
If you argue with an idiot he will drag you down to his level and beat you with experience.

I am not a fast writer.
I am not a slow writer.
I am a half-fast writer.

-Robert Asprin
killians45 is offline  
Old 12-08-2006, 03:37 PM   #5 (permalink)
Super Techie
 
Join Date: Jun 2006
Posts: 489
Default

alright, thanks, I was able to get it to work with msgbox, but with the inputbox it would be different. is there still a way to make it so if you press a button with the inputbox depending on the button you click, the response will be different?
__________________
Torvalds was contemptuous of Microsoft's claims and has asked Redmond to name the patent infringements so that their veracity can be challenged and workarounds found.
"Naming them would either make it clear that Linux is not infringing at all (which is quite possible, especially if the patents are bad), or would make it possible to avoid infringing by coding around whatever silly thing they claim,"

"So the whole 'We have a list and we're not telling you' should tell you something. Don't you think that if Microsoft actually had some really foolproof patent, they'd just tell us and go, 'nyaah, nyaah, nyaah!'?"

whole story here: http://www.vnunet.com/vnunet/news/21...-microsoft-put
kpmwrestler is offline  
Old 12-10-2006, 06:14 PM   #6 (permalink)
Wizard Techie
 
Join Date: Apr 2004
Posts: 3,247
Default

yes, you would need a global (I think its called that) variable that puts whatever is in the input box into a string. This would be globaly available. Its not called global variable and cant remember what it is called but essentially, it is available via all subs.
__________________
If you argue with an idiot he will drag you down to his level and beat you with experience.

I am not a fast writer.
I am not a slow writer.
I am a half-fast writer.

-Robert Asprin
killians45 is offline  
Old 12-10-2006, 07:47 PM   #7 (permalink)
It's all just 1s and 0s
 
office politics's Avatar
 
Join Date: Jan 2004
Location: in the lab
Posts: 6,555
Send a message via MSN to office politics
Default

vbscript reference

msgbox - http://www.devguru.com/technologies/vbscript/13955.asp

inputbox - http://www.devguru.com/technologies/vbscript/13933.asp
__________________

office politics is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 12:10 AM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.