我是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) 如果我理解正确的话,我想知道异步连接中的定时器的一个方面.
假设我们在执行读操作之前设置了一个计时器,其中包括一个处理程序,然后run()是io_service.
据我了解,io_service在调用后经理结束后立即结束,这可能有两个原因:
a)读操作完成.
b)计时器已达到极限.
假设已达到第一个(a)条件,并且在计时器结束之前已完成读取操作.
问题是:该计时器会发生什么?我们需要完成它吗?说
dTimer_.expires_from_now (boost::posix_time::seconds(0));
after the io_service.run()?
Run Code Online (Sandbox Code Playgroud)
如果有必要可以将相同的计时器对象重新用于另一个读操作,是否可以将其重置为新的时间间隔?
我可以重置()io_service并在run()新操作中重用相同的对象吗?
我有一个3层win表单应用程序,它有一个UI,BLL和DAL.我想添加一个异常处理程序,它将DAL中的异常一直抛到UI,以便用户知道错误是什么.我已尝试使用try {} catch {}并将其从DAL中抛出,但这只会将其抛出到BLL并停在那里.有没有办法把它扔回UI?
谢谢
编辑:
码:
我在"PAGE A"中有这个测试代码:
<?php
require_once('../mysite/php/classes/eventManager.php');
$x=new EventManager();
$y=$x->loadNumbers();
?>
Run Code Online (Sandbox Code Playgroud)
"eventManager.php"里面有一个require_once:
<?php
require_once('../includes/dbconn.inc');
class EventManager {...}
?>
Run Code Online (Sandbox Code Playgroud)
我的文件夹结构是这样的:
mysite/php/classes folder and includes folder
Run Code Online (Sandbox Code Playgroud)
如果我在浏览器中测试PAGE A,我会收到:
警告:require_once(../ includes/dbconn.inc)[function.require-once]:无法打开流:C:\ wamp\www\mysite\php\classes\eventManager.php中没有这样的文件或目录3
致命错误:require_once()[function.require]:在C:\ wamp\www\mysite\php中打开所需的'../includes/dbconn.inc'(include_path ='.; C:\ php5\pear')失败第3行的\ classes\eventManager.php
错误在哪里?
谢谢卢卡
我希望正则表达式可以解析具有可选前导空格的固定长度字段中的右对齐数值.(这基本上是FORTRAN输出,但还有许多其他工具可以做到这一点).我知道场地的宽度.
假设该字段是宽度为5(I5)的整数.然后以下是所有符合的数值:
" 123"
"12345"
"-1234"
" -1"
Run Code Online (Sandbox Code Playgroud)
我不能对前面和后面的字段做出任何假设.因此以下内容适用于I3,I5,I2:
"-121234512"
Run Code Online (Sandbox Code Playgroud)
并产生价值-12, 12345和12.
应该没有与正则表达式相关的其他代码.我正在使用Java正则表达式,但我希望这是相当普遍的(至少符合C#).
如果可以对整数进行此操作,我还希望正则数据包含包含小数点的实数,例如 F10.3
" -12.123"
Run Code Online (Sandbox Code Playgroud) 我可以使用以下代码从运行的应用程序中获取Window句柄.
foreach (ProcessModule module in process.Modules)
{
if (module.ModuleName.Contains("PresentationFramework.dll") || module.ModuleName.Contains("PresentationFramework.ni.dll"))
{
IntPtr window = process.MainWindowHandle;
}
}
Run Code Online (Sandbox Code Playgroud)
但我想从这个处理程序中获取Window实例.可能吗?
有什么好主意吗?
例如,假设我有
SELECT sum(...) as total
Run Code Online (Sandbox Code Playgroud)
我能做点什么吗
WHERE total > 10
Run Code Online (Sandbox Code Playgroud)
当我尝试实际语法时,我在使用MySQL的'where子句'中获得了一个错误未知列'total'
// main.cpp
#include <QApplication>
#include "mainwindow.h"
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
MainWindow* window = new MainWindow();
window->show();
return app.exec();
}
// mainwindow.cpp
#include <QTimer>
#include <QMessageBox>
#include <iostream>
#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
this->setCentralWidget(new QWidget());
}
void MainWindow::mousePressEvent(QMouseEvent* event)
{
this->hide();
QTimer* timer = new QTimer();
timer->setInterval(3*1000);
timer->start();
connect(timer, SIGNAL(timeout()), this, SLOT(showMessageBox()));
}
void MainWindow::showMessageBox()
{
QMessageBox::information(this, "Hello,", "world!", QMessageBox::Ok);
}
MainWindow::~MainWindow()
{
std::cerr << "Destructor called" << std::endl;
}
Run Code Online (Sandbox Code Playgroud)
我点击窗口 - 它隐藏,QMessageBox出现.我单击"确定" - …
我正在尝试使用Word 2007中的VBA创建代表表单文档的代码.我创建了表示Section,QuestionSet和Question的类.
所以我有15个部分.我创建了一个函数来创建每个'Section'对象将它添加到'Sections'集合然后销毁对象,结果是对象在集合中保持持久性(或者其他东西).
是否可以使用相同的方法将集合添加到集合中,或者我是否必须明确定义每个集合?
模块中的代码:
Public Sections As Collection
Function DefineSection(ByVal SectionName As String)
Set Section = New clsSection
Section.myName = SectionName
Sections.Add Section, SectionName
End Function
Function DefineQuestionSet(ByVal SectionName As String, ByVal Name As String, ByVal NoOfQuestions As Integer, ByVal IsMutuallyExclusive As Boolean, Optional ByVal DependentOnSection As String)
Dim Qsets As Collection
Set Qsets = New Collection
Set QuestionSet = New clsQuestionSet
QuestionSet.Name = Name
QuestionSet.NoOfQuestions = NoOfQuestions
QuestionSet.MutuallyExclusive = IsMutuallyExclusive
If Not (DependentOnSection) = "" Then
QuestionSet.DependentOnSection = …Run Code Online (Sandbox Code Playgroud) 在WPF应用程序中集成本地(因此不是联机)帮助的可能方法是什么?它更像是手册,但我想以某种方式整合它.
编辑:刚刚找到http://wordtoxaml.codeplex.com,我会尝试那个.它将word文档转换为xaml,我可以在WPF中显示它.
编辑2:我找到了一个有效的解决方案:用word编写手册,另存为XPS,并使用https://web.archive.org/web/20111116005415/http://www.umutluoglu.com/english/post/显示一十二分之二千零八/ 20 /显示-XPS-文档与-的DocumentViewer -控制-在-WPF.aspx
c# ×3
c++ ×2
wpf ×2
.net ×1
boost ×1
boost-asio ×1
collections ×1
dreamweaver ×1
excel ×1
excel-vba ×1
fatal-error ×1
messagebox ×1
mono ×1
mysql ×1
php ×1
qmainwindow ×1
qmessagebox ×1
qt ×1
qt4 ×1
regex ×1
require ×1
sql ×1
vba ×1
word-vba ×1