![](/img/trans.png)
[英]How can i read and display info from multiple text files in 1 message box C#?
[英]Information that used in console application in c# how can i write same info in message box
大家好,我的问题很容易认识人,但我不知道。 问题是代码中的这个
object value = vr.ReadTypedValue();
Console.WriteLine("{0}({1},{2}):{3}", vr.NodeType, vr.Name, value.GetType().Name, value);
我想将vr.NodeType,vr.Name,value.GetType()。Name信息写入MessageBox.Show在其中。我该怎么办或如何修改此代码来解决我的问题
在控制台应用程序中:
添加
System.Windows.Forms.dll //Ty Alex
到您的项目并添加winforms代码。
在winforms =
MessageBox.Show(string.Format("{0}({1},{2}):{3}",
vr.NodeType,
vr.Name,
value.GetType().Name,
value));
消息框代码
MessageBox.Show("this shows a messagebox");
格式码
string.Format("This line formats a {0} with the given {1}","string", "params");
格式化讯息
string message = String.Format("{0}({1},{2}):{3}",
vr.NodeType, vr.Name, value.GetType().Name, value);
并在MessageBox
显示它:
MessageBox.Show(message);
object value = vr.ReadTypedValue();
string message = string.Format("{0}({1},{2}):{3}", vr.NodeType, vr.Name, value.GetType().Name, value);
System.Windows.Form.MessageBox.Show(message);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.