PC Review


Reply
Thread Tools Rate Thread

Combine multiple args into 1

 
 
DevlinM
Guest
Posts: n/a
 
      20th Feb 2010
I am curious how Msgbox combines multiple arguments into 1 for
vbMsgBoxStyle(e.g. vbInformation + vbYesNo), as I would like to implement
something like this in one of my own procedures.

Another question I am curious about is how to display argument options when
writing a procedure call. Again, similar to Msgbox, when building the
procedure call, the code window displays a list of options for each argument.

Any help is appreciated.

Devlin

 
Reply With Quote
 
 
 
 
Allen Browne
Guest
Posts: n/a
 
      20th Feb 2010
Re your first question, use powers of 2 for each element, and then parse
them with a binary AND operation.

There's an example in this Database Issue Checker Utility:
http://allenbrowne.com/Ap****ueChecker.html
You check the box for each issue you wish to check.
The form treats each as a power of 2, sums the values, and passes the result
to the function. The function then ANDs with 1, 2, 4, 8, etc, to determine
which bits are turned on.

Re your second question, use an Enum or custom Type. Then declare your
argument as this type, and the options are available.

You can even use the built-in types. For example, if your code has to accept
some type of Access object (form, report whatever), you could declare it
like this:
Public Function MyFunc(WotObject As acObjectType)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"DevlinM" <(E-Mail Removed)> wrote in message
newsB004C5C-9125-4F01-B138-(E-Mail Removed)...
> I am curious how Msgbox combines multiple arguments into 1 for
> vbMsgBoxStyle(e.g. vbInformation + vbYesNo), as I would like to implement
> something like this in one of my own procedures.
>
> Another question I am curious about is how to display argument options
> when
> writing a procedure call. Again, similar to Msgbox, when building the
> procedure call, the code window displays a list of options for each
> argument.
>
> Any help is appreciated.
>
> Devlin
>

 
Reply With Quote
 
vanderghast
Guest
Posts: n/a
 
      22nd Feb 2010
You have to be careful, if you use + instead of AND:


MsgBox "Hello", vbOKCancel + vbOKCancel

as example, does not produce an OK - Cancel, while


MsgBox "Hello",vbOKCancel AND vbOKCancel


does.


Vanderghast, Access MVP


"DevlinM" <(E-Mail Removed)> wrote in message
newsB004C5C-9125-4F01-B138-(E-Mail Removed)...
>I am curious how Msgbox combines multiple arguments into 1 for
> vbMsgBoxStyle(e.g. vbInformation + vbYesNo), as I would like to implement
> something like this in one of my own procedures.
>
> Another question I am curious about is how to display argument options
> when
> writing a procedure call. Again, similar to Msgbox, when building the
> procedure call, the code window displays a list of options for each
> argument.
>
> Any help is appreciated.
>
> Devlin
>


 
Reply With Quote
 
Stuart McCall
Guest
Posts: n/a
 
      22nd Feb 2010
"vanderghast" <vanderghast@com> wrote in message
news:F85B0A5E-0451-454E-8F74-(E-Mail Removed)...
> You have to be careful, if you use + instead of AND:
>
>
> MsgBox "Hello", vbOKCancel + vbOKCancel
>
> as example, does not produce an OK - Cancel, while
>
>
> MsgBox "Hello",vbOKCancel AND vbOKCancel
>
>
> does.
>
>
> Vanderghast, Access MVP


Er, shouldn't that be OR?


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to open a form with multiple Args Ayo Microsoft Access 1 7th Dec 2007 08:21 PM
Multiple Args to Background worker John Veldthuis Microsoft VB .NET 4 27th Dec 2005 01:20 AM
Is there a class or method to construct url args or extract url args? Ken Varn Microsoft ASP .NET 2 22nd Jun 2005 01:26 PM
multiple open args =?Utf-8?B?UnVzcw==?= Microsoft Access Form Coding 9 19th Mar 2005 10:41 PM
Re: passing multiple args or an array of args to threads William DePalo [MVP VC++ ] Microsoft VC .NET 0 10th Jul 2003 05:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:28 PM.