我写了这段代码但是当我运行它时,调试器提示我“DragDrop注册没有成功。”在FormAdver.show();行,我该如何解决?
public void ResiveFunc(string FuncResive)
{
string FuncName = "";
string FuncValue = "";
for (int i = 0; i <= 2; i++)
{
FuncName += FuncResive[i];
}
for (int j = 4; j <= FuncResive.Length - 1; j++)
{
FuncValue += FuncResive[j];
}
MessageBox.Show(FuncName);
MessageBox.Show(FuncValue);
if (FuncName == "TAB")
{
Form1 mainForm = new Form1();
frmAddver formAddver = new frmAddver();
formAddver.Show();
mainForm.AdverFilter(FuncValue);
}
}
答案 0 :(得分:0)
您有两个选择
确保FormAdver中的控件AllowDrop
为false
确保将公寓状态设置为STA。可以Thread.CurrentThread.ApartmentState = ApartmentState.STA
或使用[STAThread]
属性。