Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > PowerShell

Vista - Using [system.windows.forms.messagebox]::show()

Reply
 
Old 11-30-2006   #1 (permalink)
Marco Shaw


 
 

Using [system.windows.forms.messagebox]::show()

I might be missing something, but how do I properly add the buttons (OK and
Cancel) that I want to show?

[system.windows.forms.messagebox]::show("test","marco") works fine, but then
how do I add "messageboxbuttons.okcancel" (from what it seems to look like
in C#).

Marco



My System SpecsSystem Spec
Old 11-30-2006   #2 (permalink)
Marco Shaw


 
 

Re: Using [system.windows.forms.messagebox]::show()

> [system.windows.forms.messagebox]::show("test","marco") works fine, but
> then


Oh, and how would I actually get it to open "on screen"? I just seems to
open minimized for me...

I'll keep playing...


My System SpecsSystem Spec
Old 11-30-2006   #3 (permalink)
Rob Kenny


 
 

Re: Using [system.windows.forms.messagebox]::show()

Marco Shaw wrote:
> I might be missing something, but how do I properly add the buttons (OK and
> Cancel) that I want to show?
>
> [system.windows.forms.messagebox]::show("test","marco") works fine, but then
> how do I add "messageboxbuttons.okcancel" (from what it seems to look like
> in C#).
>
> Marco
>
>


Use [System.Windows.Forms.MessageBoxButtons]::OKCancel

In PowerShell :: seems gets used in place of . in C# when calling .NET
stuff.

Rob Kenny
My System SpecsSystem Spec
Old 11-30-2006   #4 (permalink)
Flowering Weeds


 
 

Re: Using [system.windows.forms.messagebox]::show()


"Marco Shaw"

> how do I add "messageboxbuttons.okcancel"


Live Search
http://search.live.com/results.aspx?...+%2BPowerShell



My System SpecsSystem Spec
Old 11-30-2006   #5 (permalink)
Brandon Shell


 
 

Re: Using [system.windows.forms.messagebox]::show()

Not exactly... AFAIK :: is only used when calling static methods on a Class

"Rob Kenny" <rob@otherniceman.net> wrote in message
news:uq4waULFHHA.2452@TK2MSFTNGP06.phx.gbl...
> Marco Shaw wrote:
>> I might be missing something, but how do I properly add the buttons (OK
>> and Cancel) that I want to show?
>>
>> [system.windows.forms.messagebox]::show("test","marco") works fine, but
>> then how do I add "messageboxbuttons.okcancel" (from what it seems to
>> look like in C#).
>>
>> Marco

>
> Use [System.Windows.Forms.MessageBoxButtons]::OKCancel
>
> In PowerShell :: seems gets used in place of . in C# when calling .NET
> stuff.
>
> Rob Kenny


My System SpecsSystem Spec
Old 11-30-2006   #6 (permalink)
/\\/\\o\\/\\/ [MVP]


 
 

Re: Using [system.windows.forms.messagebox]::show()

ask PoSH for help :

you can find out by doing this :

PoSH>[system.windows.forms.messagebox] | Get-Member -static


TypeName: System.Windows.Forms.MessageBox

Name MemberType Definition
---- ---------- ----------
Equals Method static System.Boolean Equals(Object objA, Object
objB)
ReferenceEquals Method static System.Boolean ReferenceEquals(Object
objA, Object objB)
Show Method static System.Windows.Forms.DialogResult
Show(String text, String caption, MessageBoxButt...

for a comple list (many overloads) do this :

PoSH>[system.windows.forms.messagebox] | Get-Member -static | Format-List

TypeName : System.Windows.Forms.MessageBox
Name : Show
MemberType : Method
Definition : static System.Windows.Forms.DialogResult Show(String text,
String caption, MessageBoxButtons buttons, Mess
ageBoxIcon icon, MessageBoxDefaultButton defaultButton,
MessageBoxOptions options, Boolean displayHelpButt
on), static System.Windows.Forms.DialogResult Show(String text,
String caption, MessageBoxButtons buttons,
MessageBoxIcon icon, MessageBoxDefaultButton defaultButton,
MessageBoxOptions options, String helpFilePat
h), static System.Windows.Forms.DialogResult Show(IWin32Window
owner, String text, String caption, Message
BoxButtons buttons, MessageBoxIcon icon,
MessageBoxDefaultButton defaultButton, MessageBoxOptions options,
String helpFilePath), static System.Windows.Forms.DialogResult
Show(String text, String caption, MessageB
oxButtons buttons, MessageBoxIcon icon, MessageBoxDefaultButton
defaultButton, MessageBoxOptions options,
String helpFilePath, String keyword), static
System.Windows.Forms.DialogResult Show(IWin32Window owner, St
ring text, String caption, MessageBoxButtons buttons,
MessageBoxIcon icon, MessageBoxDefaultButton default
Button, MessageBoxOptions options, String helpFilePath, String
keyword), static System.Windows.Forms.Dialo
gResult Show(String text, String caption, MessageBoxButtons
buttons, MessageBoxIcon icon, MessageBoxDefaul
tButton defaultButton, MessageBoxOptions options, String
helpFilePath, HelpNavigator navigator), static Sy
stem.Windows.Forms.DialogResult Show(IWin32Window owner, String
text, String caption, MessageBoxButtons bu
ttons, MessageBoxIcon icon, MessageBoxDefaultButton
defaultButton, MessageBoxOptions options, String helpF
ilePath, HelpNavigator navigator), static
System.Windows.Forms.DialogResult Show(String text, String capti
on, MessageBoxButtons buttons, MessageBoxIcon icon,
MessageBoxDefaultButton defaultButton, MessageBoxOptio
ns options, String helpFilePath, HelpNavigator navigator,
Object param), static System.Windows.Forms.Dialo
gResult Show(IWin32Window owner, String text, String caption,
MessageBoxButtons buttons, MessageBoxIcon ic
on, MessageBoxDefaultButton defaultButton, MessageBoxOptions
options, String helpFilePath, HelpNavigator n
avigator, Object param), static
System.Windows.Forms.DialogResult Show(String text, String caption, Messag
eBoxButtons buttons, MessageBoxIcon icon,
MessageBoxDefaultButton defaultButton, MessageBoxOptions options
), static System.Windows.Forms.DialogResult Show(String text,
String caption, MessageBoxButtons buttons, M
essageBoxIcon icon, MessageBoxDefaultButton defaultButton),
static System.Windows.Forms.DialogResult Show(
String text, String caption, MessageBoxButtons buttons,
MessageBoxIcon icon), static System.Windows.Forms.
DialogResult Show(String text, String caption,
MessageBoxButtons buttons), static System.Windows.Forms.Dia
logResult Show(String text, String caption), static
System.Windows.Forms.DialogResult Show(String text), s
tatic System.Windows.Forms.DialogResult Show(IWin32Window
owner, String text, String caption, MessageBoxBu
ttons buttons, MessageBoxIcon icon, MessageBoxDefaultButton
defaultButton, MessageBoxOptions options), sta
tic System.Windows.Forms.DialogResult Show(IWin32Window owner,
String text, String caption, MessageBoxButt
ons buttons, MessageBoxIcon icon, MessageBoxDefaultButton
defaultButton), static System.Windows.Forms.Dial
ogResult Show(IWin32Window owner, String text, String caption,
MessageBoxButtons buttons, MessageBoxIcon i
con), static System.Windows.Forms.DialogResult
Show(IWin32Window owner, String text, String caption, Messa
geBoxButtons buttons), static System.Windows.Forms.DialogResult
Show(IWin32Window owner, String text, Stri
ng caption), static System.Windows.Forms.DialogResult
Show(IWin32Window owner, String text)

PS playing with the WIndow owner and a form might also a way to handle focus
problem

Greetings /\/\o\/\/

----- Original Message -----
From: "Brandon Shell" <tshell.mask@gmail.com>
Newsgroups: microsoft.public.windows.powershell
Sent: Thursday, November 30, 2006 8:57 PM
Subject: Re: Using [system.windows.forms.messagebox]::show()


> Not exactly... AFAIK :: is only used when calling static methods on a
> Class
>
> "Rob Kenny" <rob@otherniceman.net> wrote in message
> news:uq4waULFHHA.2452@TK2MSFTNGP06.phx.gbl...
>> Marco Shaw wrote:
>>> I might be missing something, but how do I properly add the buttons (OK
>>> and Cancel) that I want to show?
>>>
>>> [system.windows.forms.messagebox]::show("test","marco") works fine, but
>>> then how do I add "messageboxbuttons.okcancel" (from what it seems to
>>> look like in C#).
>>>
>>> Marco

>>
>> Use [System.Windows.Forms.MessageBoxButtons]::OKCancel
>>
>> In PowerShell :: seems gets used in place of . in C# when calling .NET
>> stuff.
>>
>> Rob Kenny

>


My System SpecsSystem Spec
Old 11-30-2006   #7 (permalink)
/\\/\\o\\/\\/ [MVP]


 
 

Re: Using [system.windows.forms.messagebox]::show()

this might help :

http://www.microsoft.com/technet/scr.../inputbox.mspx

Greetings /\/\o\/\/

----- Original Message -----
From: "Marco Shaw" <marco@Znbnet.nb.ca>
Newsgroups: microsoft.public.windows.powershell
Sent: Thursday, November 30, 2006 8:14 PM
Subject: Re: Using [system.windows.forms.messagebox]::show()


>> [system.windows.forms.messagebox]::show("test","marco") works fine, but
>> then

>
> Oh, and how would I actually get it to open "on screen"? I just seems to
> open minimized for me...
>
> I'll keep playing...
>


"Marco Shaw" <marco@Znbnet.nb.ca> wrote in message
news:Ok$mf3KFHHA.320@TK2MSFTNGP06.phx.gbl...
>I might be missing something, but how do I properly add the buttons (OK and
>Cancel) that I want to show?
>
> [system.windows.forms.messagebox]::show("test","marco") works fine, but
> then how do I add "messageboxbuttons.okcancel" (from what it seems to look
> like in C#).
>
> Marco
>


My System SpecsSystem Spec
Old 11-30-2006   #8 (permalink)
/\\/\\o\\/\\/ [MVP]


 
 

Re: Using [system.windows.forms.messagebox]::show()

I have a lot of GUI examples on my blog,

for example :

In this example I use a button (hidden as size is 1,1 change to 20,20 for
example to see the button and to test) and set it as default :
also you can see a trick to get the form in focus
http://mow001.blogspot.com/2006/10/p...ction-gui.html

and if you need to add a lot of buttons ;-)

http://mow001.blogspot.com/2005/11/m...-gui-game.html

another example that I did translate from a HTA scripting example .
http://mow001.blogspot.com/2006/02/m...ames-part.html

and more

Greetings /\/\o\/\/

----- Original Message -----
From: "Marco Shaw" <marco@Znbnet.nb.ca>
Newsgroups: microsoft.public.windows.powershell
Sent: Thursday, November 30, 2006 7:32 PM
Subject: Using [system.windows.forms.messagebox]::show()


>I might be missing something, but how do I properly add the buttons (OK and
>Cancel) that I want to show?
>
> [system.windows.forms.messagebox]::show("test","marco") works fine, but
> then how do I add "messageboxbuttons.okcancel" (from what it seems to look
> like in C#).
>
> Marco
>


My System SpecsSystem Spec
Old 11-30-2006   #9 (permalink)
/\\/\\o\\/\\/ [MVP]


 
 

Re: Using [system.windows.forms.messagebox]::show()

Oops, sorry double post,
I'm messing up with Windows Mail (vista)

Gr /\/\o\/\/

My System SpecsSystem Spec
Old 12-01-2006   #10 (permalink)
Bruce Payette [MSFT]


 
 

Re: Using [system.windows.forms.messagebox]::show()

The '::' works for any static member - methods, properties or fields but you
don't really need it in this case. Just pass in the string. The type
converter will take care of it for you:

[system.windows.forms.messagebox]::show("hello","there","okcancel")

-bruce
--
Bruce Payette [MSFT]
Windows PowerShell Technical Lead
Microsoft Corporation
This posting is provided "AS IS" with no warranties, and confers no rights.

Visit the Windows PowerShell Team blog at:
http://blogs.msdn.com/PowerShell
Visit the Windows PowerShell ScriptCenter at:
http://www.microsoft.com/technet/scr.../hubs/msh.mspx
My Book: http://manning.com/powershell
"Brandon Shell" <tshell.mask@gmail.com> wrote in message
news:%23GfYQpLFHHA.2468@TK2MSFTNGP06.phx.gbl...
> Not exactly... AFAIK :: is only used when calling static methods on a
> Class
>
> "Rob Kenny" <rob@otherniceman.net> wrote in message
> news:uq4waULFHHA.2452@TK2MSFTNGP06.phx.gbl...
>> Marco Shaw wrote:
>>> I might be missing something, but how do I properly add the buttons (OK
>>> and Cancel) that I want to show?
>>>
>>> [system.windows.forms.messagebox]::show("test","marco") works fine, but
>>> then how do I add "messageboxbuttons.okcancel" (from what it seems to
>>> look like in C#).
>>>
>>> Marco

>>
>> Use [System.Windows.Forms.MessageBoxButtons]::OKCancel
>>
>> In PowerShell :: seems gets used in place of . in C# when calling .NET
>> stuff.
>>
>> Rob Kenny

>



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
System.Windows.Forms.Form PowerShell
simulate continuous forms & subforms in a windows forms application .NET General
Questions regarding system.windows.forms PowerShell
[system.Windows.Forms.MessageBox] PowerShell
Data Fetching and system.windows.forms.form & .datagridview PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46