|
-
Feb 6th, 2006, 01:11 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] is there a Ok/ Cancel message box equivalent?
Hi. Is there anything in c# where you could popup and ask the user to enter probably some simple text or a yes / cancel two button option like in Java?
Jennifer
-
Feb 6th, 2006, 01:12 PM
#2
Thread Starter
Hyperactive Member
Re: is there a Ok/ Cancel message box equivalent?
Something like the JOptionPane in Java.
-
Feb 6th, 2006, 01:59 PM
#3
Fanatic Member
Re: is there a Ok/ Cancel message box equivalent?
If you were programming in VB you just would of used InputBox(), but this has been done away with and you apparently come from a Java background.
So your options are to reference the old InputBox() through the old VB namespace, or to just create your own. Or you can visit the first link where I believe it is already made.
http://www.devhood.com/Tools/tool_de...px?tool_id=295
http://faculty.juniata.edu/rhodes/smui/csmsgbox.htm
-
Feb 6th, 2006, 02:09 PM
#4
Re: is there a Ok/ Cancel message box equivalent?
The MessageBox class can display text and you can add buttons for yes or No. No text input though
-
Feb 6th, 2006, 02:27 PM
#5
Re: is there a Ok/ Cancel message box equivalent?
If you were programming in "legacy" VB, you would use the InputBox()
(You probably meant it that way, I just wanted to clarify the difference )
The yes/no messagebox option is avaliable in the Framework.
Code:
private void Form1_Load(object sender, System.EventArgs e)
{
System.Windows.Forms.DialogResult Response;
Response = System.Windows.Forms.MessageBox.Show("Contents", "Caption", System.Windows.Forms.MessageBoxButtons.YesNo);
switch(Response)
{
case System.Windows.Forms.DialogResult.Yes:
System.Windows.Forms.MessageBox.Show("YES");
break;
case System.Windows.Forms.DialogResult.No:
System.Windows.Forms.MessageBox.Show("NO");
break;
default:
break;
}
}
As far as creating your own (like the previous posts), it is your best way to go. Remember to use .ShowDialog() instead of .Show. It will display modally that way.
-
Feb 13th, 2006, 09:25 AM
#6
Thread Starter
Hyperactive Member
Re: is there a Ok/ Cancel message box equivalent?
Thanks guys! it worked.
Jennifer
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
|