English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I keep getting an error on this code. My compiler seems not to like the using System.Windows.Forms. Why?
using System;
using System.Windows.Forms;
public class DebugNineOne
{

public static void Main()
{
string caption = "Famous quote";
MessageBox.show(caption,"To be...");
caption += " continued";
MessageBox.show("or not to be...", caption);
MessageBox.display("That is the question", caption);
}
}

2006-12-17 13:07:04 · 2 answers · asked by Christina 2 in Computers & Internet Programming & Design

This is a C# code not Java

2006-12-17 13:38:02 · update #1

2 answers

Last line:

MessageBox.display("That is the question", caption);

should be:

MessageBox.show("That is the question", caption);

Also, you've reversed your arguments in the last two lines. They should be:

MessageBox.show(caption, "or not to be...");
MessageBox.show(caption, "That is the question");

2006-12-17 13:16:12 · answer #1 · answered by Anonymous · 0 1

try this code

import java.*;
import java.awt.*;
import javax.swing.*;

public class test
{

public static void main(String args[])
{
String caption = "Famous quote";
JOptionPane.showMessageDialog(null,caption + "To be...");
caption += " continued";
JOptionPane.showMessageDialog(null,"or not to be..."+ caption);
JOptionPane.showMessageDialog(null,"This is the question: "+ caption);
}
}

2006-12-17 13:23:37 · answer #2 · answered by Anonymous · 0 1

fedest.com, questions and answers