Problem in Form Show
i wrote this code but when i run it the debugger prompt me "DragDrop registration did not succeed." in FormAdver.show(); line , how can i fix it ?
public void ResiveFunc(string FuncResive)
{
string FuncName = "";
string FuncValue = "";
for (int i = 0; i <= 2; i++)
{
FuncName += FuncResive[i];
}
开发者_StackOverflowfor (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);
}
}
You have two options
Make sure
AllowDrop
isfalse
on the controls in FormAdverMake sure the the Apartment State is set to STA. Either by
Thread.CurrentThread.ApartmentState = ApartmentState.STA
or using the[STAThread]
attribute.
精彩评论