Microsoft.VisualBasic.Interaction.InputBox(“提供ID变异”,“变异”,“输入您的ID”);
我能够阅读输入,但是如何?
此外,是否有可能如果我按下1之类的数字,我将获得以下所有信息?
Mp3Player player1 = new Mp3Player(1, "GET Technologies .inc", "HF 410", 4096, 129.95M, 500);
答案 0 :(得分:1)
您可以指定结果:
string id = Microsoft.VisualBasic.Interaction.InputBox("Give an ID to mutate", "Mutation", "Enter your ID");
如果您尝试将此转换为数字,则需要将字符串转换为数字:
string idString = Microsoft.VisualBasic.Interaction.InputBox("Give an ID to mutate", "Mutation", "Enter your ID");
int id;
if (int.TryParse(idString, out id))
{
Mp3Player player = new Mp3Player(id, "GET Technologies .inc", "HF 410", 4096, 129.95M, 500);
}
else
{
// The user typed something that wasn't a number
}