0
我正在將我的舊應用程序從Windows窗體移動到WPF,並在此方法中遇到帶下劃線的錯誤。任何人都可以幫助解決DoEvents上的這些問題; SuspendLayout; ResumeLayout。我的老方法:在WPF應用程序中查找SQL服務器
private void FindDataBases()
{
string tempDBName = comboBoxDataBases.Text;
// ((FrameworkElement) this).Cursor = Cursors.WaitCursor;
((FrameworkElement)this).Cursor = Cursors.Wait;
Application.DoEvents();
SuspendLayout();
DataSet dataBases = GetDatabases();
((FrameworkElement) this).Cursor = Cursors.Default;
Application.DoEvents();
if ((dataBases != null) && (dataBases.Tables[0].Rows.Count > 0))
{
comboBoxDataBases.DisplayMember = "DbName";
comboBoxDataBases.DataSource = dataBases.Tables[0];
if (comboBoxDataBases.FindStringExact(tempDBName) > 0)
{
comboBoxDataBases.SelectedIndex = comboBoxDataBases.FindStringExact(tempDBName);
}
}
else
{
comboBoxDataBases.DataSource = null;
}
ResumeLayout();
// this.comboBoxDataBases.Focus();
}
你能告訴我們問題是什麼嗎?什麼是錯誤信息? – 2009-10-28 13:25:48
正如我所說的DoEvents; SuspendLayout; ResumeLayout是事情,不再工作在WPF – Vytas 2009-10-28 14:14:38
我只需要做WPF中的某種方式,就像我在發佈的方法中那樣。 – Vytas 2009-10-28 14:15:38