我知道可以用Windows做这样的事情:
MessageBox(hWnd, "Yes, No, or Cancel?", "YNCB_YESNOCANCEL);
Run Code Online (Sandbox Code Playgroud)
但是我如何对用户按下的内容作出反应(如果他们点击"是"那么关闭窗口)?
所以有几个愚蠢的问题:
如果我在某些情况下包括这个:
MsgBox " ", vbOkOnly, "This little message box"
Run Code Online (Sandbox Code Playgroud)
我可以用更多的代码转过来然后'点击确定按钮.那么基本上消息boox会自动弹出,然后自动消失?
我知道它很愚蠢,因为你想知道,为什么你想要消息框然后......
以及a)我只是想知道你是否能做到这一点,以及命令是什么
b)我有一些在消息框出现时可见的基本形状(形状对象).但是,如果没有消息框,则在等待单击按钮时不会暂时中断代码,因此可见的漂亮图像对象会在窗体上生效.
所以我真的不需要消息框,只需要显示对象的临时中断.
谢谢!
我想显示一个带有像这样的双字值的消息对话框
MessageBox(0,(LPCWSTR)hProcess,TEXT("我的消息框信息"),MB_OK | MB_ICONERROR);
hProcess是一个DWORD值,但是当消息框出现时,应显示dowrd值的消息的正文部分为空.
这可能很简单,但我是MFC的新手.
我有一个消息框:
MessageBox("Do You Want to Save the Configuration Changes","NDS",1);
Run Code Online (Sandbox Code Playgroud)
哪个有Ok和Cancel选项.我想点击确定编写我的代码
我是monodevelop的初学者,我试图根据按钮点击显示一个消息框.代码工作正常,除非显示if/else语句下的bex消息,否则我无法关闭它.单击"确定"或"x"按钮不会关闭MessageBox
namespace SampleGtkProj
{
public partial class First : Gtk.Window
{
protected virtual void buttonClicked (object sender, System.EventArgs e)
{
MessageBox.Show(entry1.Text);
if(File.Exists(entry1.Text)) {
MessageBox.Show("File Exists: test passed");}
else {
MessageBox.Show("FIle DOes NOt exist test failed");}
}
public First() : base(Gtk.WindowType.Toplevel)
{
this.Build ();
}
}
}
Run Code Online (Sandbox Code Playgroud) 我想在给定位置显示MessageBox.我不希望MessageBox覆盖并隐藏父窗体的一部分.有没有办法使用默认的MessageBox对象来指定自定义位置?
我在VS 2008中使用C#和.Net Framework 3.5
我注意到,如果一些MessageBox出现,你甚至只需要在其上的OK按钮,用户点击从Windows Phone 7的后退按钮时,您将收到Cancel在MessageBoxResult.
有人经历过吗?
我很难将我的休息调用中的请求内容写入 txt 文件。
我得到了一个响应,我可以将它输出到控制台,但我真的很想把它写到一个文本文件中。我倾向于将其视为编码问题,但我不确定在哪里设置或配置它。
我写的 Messagebox 和文件的内容都是空的。
static void Main(string[] args)
{
// Create the web request
HttpWebRequest request = WebRequest.Create("http://finance.yahoo.com/q/ecn") as HttpWebRequest;
// Set type to POST
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
string query = "?s=PVSW";
StringBuilder data = new StringBuilder();
data.Append("&query=" + HttpUtility.UrlEncode(query));
System.Windows.Forms.MessageBox.Show("Data = " + data.ToString());
// Create a byte array of the data we want to send
byte[] byteData = UTF8Encoding.UTF8.GetBytes(data.ToString());
// Set the content length in the request headers
request.ContentLength = byteData.Length;
// …Run Code Online (Sandbox Code Playgroud) 我正在运行一个宏,Private Sub Workbook_BeforeClose(Cancel As Boolean)
但每当用户点击取消按钮宏不应该运行.
我一直在遵循代码行
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Cancel = True Then
MsgBox "You clicked on Cancel"
ElseIf Cancel = False Then
Call SDA
End If
Run Code Online (Sandbox Code Playgroud)
End Sub
但是每当我按下取消按钮时它都没有显示任何MessageBox.Any帮助将非常感激.
我可以在列表框中将多个选定项目显示在按钮单击的文本框中,但如何在消息框中显示相同的内容?我的意思是在消息框上显示第一项不是问题,而是同时显示多个项目.建议请......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace cities
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Clear();
foreach (object selectedItem in listBox1.SelectedItems)
{
textBox1.AppendText(selectedItem.ToString() + Environment.NewLine);
}
}
private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
Run Code Online (Sandbox Code Playgroud) messagebox ×10
c# ×4
c++ ×3
vba ×2
windows ×2
.net ×1
access-vba ×1
back-button ×1
dword ×1
encoding ×1
events ×1
excel ×1
listbox ×1
mfc ×1
mono ×1
ms-access ×1
rest ×1
text-files ×1
winapi ×1