To perform two functionalities on single event

  •  11-25-2010, 2:14 AM

    To perform two functionalities on single event

    Hi,
    I am using C# .net with AutoCAD API. I need to highlight the find text in the drawing and then replace the text. highlighting part is done, for replace first i need to clear highlighted box then replace the text; for that I am using sendkeys to cancel selection. the replace is working but I need to click twice on the button as on first click it removes the selection and on second click it replaces the text whereas everything should happen on single click. Here is some sample code:

    private void btnReplace_Click(object sender, EventArgs e)

    {

    if (SetForegroundWindow(Autodesk.AutoCAD.ApplicationServices.Application.MainWindow.Handle))

    SendKeys.SendWait("{ESC}");

    ReplaceText();
    }
     
    I don't know where i am going wrong...
    Any help will be Appreciated...
     
    Thanks in advance.
    Filed under:
View Complete Thread