Reputation: 1525
i am new to c# , and i am trying to write a piece of code that is equivalent to code written in java below.
i need an input dialogue that asksthe user to enter his choice, sadly my attempts ended in both run time and compile time errors:)
i would apperciate your help
this is the code in java , which i am trying to implement in c#
do{
String name = JOptionPane.showInputDialog(null, "PLEASE ENTER YOUR CHOICE OF SQUARE NUMBER");
choice = Integer.parseInt(name);
choice --;
}while(TicTac[choice]!=' ');
Thank You:)
Upvotes: 0
Views: 6069
Reputation: 17749
@Daniel White is correct. C# doesn't have that dialog. You can load the VB.Net equivolent using his example. See here: What is the C# version of VB.net's InputDialog? for more.
For the rest of your code:
while (TicTac[choice] != ' ')
{
String name = Microsoft.VisualBasic.Interaction.InputBox(null, "PLEASE ENTER YOUR CHOICE OF SQUARE NUMBER");
choice = Integer.parseInt(name);
choice --;
}
Thats a quick copy/paste but should get you close
Upvotes: 0
Reputation: 190966
Add a reference to Microsoft.VisualBasic.dll
.
Call Microsoft.VisualBasic.Interaction.InputBox(...)
.
Upvotes: 2