I am developing an application in visual studio 2012. in MainClass
In Calling Form
It works sometimes and sometimes doesn't .
Example : When i use the F8 key it works well,but When using the F9 key it do nothing . when i try to debug it works well.
Code:
public static bool shrtcutky(System.Windows.Forms.Keys e, System.Windows.Forms.Form myform, System.Windows.Forms.ToolStrip tolbr, String db, String cmd, String ky, String[] arr)
{
switch (e)
{
case System.Windows.Forms.Keys.F4 | System.Windows.Forms.Keys.Control:
{
myform.Close();
return true;
}
case System.Windows.Forms.Keys.F3:
{
SetCancelBtn(myform, tolbr);
return true;
}
case System.Windows.Forms.Keys.F5 :
{
return true;
}
case System.Windows.Forms.Keys.F6 :
{
return true;
}
case System.Windows.Forms.Keys.F7:
{
System.Windows.Forms.Form FViewAll = new FViewAll(myform, tolbr, db, cmd, ky, arr);
FViewAll.ShowDialog(myform);
getLan(FViewAll);
return true;
}
case System.Windows.Forms.Keys.F8:
{
SetFirstBtn(myform, tolbr, db, ky);
return true;
}
case System.Windows.Forms.Keys.F9 :
{
if (Int32.Parse(tolbr.AccessibleDescription) > 1)
SetPrvBtn(myform, tolbr, db, ky);
return true;
}
case System.Windows.Forms.Keys.F10:
{
if (Int32.Parse(tolbr.AccessibleDescription) < Int32.Parse(tolbr.AccessibleName))
SetNextBtn(myform, tolbr, db, ky);
return true;
}
case System.Windows.Forms.Keys.F11 :
{
SetLastBtn(myform, tolbr, db, ky);
return true;
}
}
return true;
}
}
Code:
protected override bool ProcessCmdKey(ref Message message, Keys keys)
{
MainClass.shrtcutky(keys, this, Toolbar, db, cmd, ky, arr);
return base.ProcessCmdKey(ref message, keys);
}
Example : When i use the F8 key it works well,but When using the F9 key it do nothing . when i try to debug it works well.