Tech Off Thread

3 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

form keeps loosing focus on VS2005

Back to Forum: Tech Off
  • User profile image
    Shark_M

    hello guys
    I have this problem, where one form opens a new instance of a nother form, via a button click event in the first form. Now there is a text box in the second form. when i press enter in that text box, its supposed to fireup a method, and it does what it does

    but after this is happened , the second form loses its focus, and the first one, becomes on top of it,  although the second form is highlighted..


    i checked if the property TopMost is set to true or not, but neither of the two forms has this property set to true by default


    so why does the second form keep loosing its focus, and the first one gets the focus, or get to the topmost position....

    the first form is the startup form

  • User profile image
    footballism

    Post the code please.

    Sheva

  • User profile image
    Shark_M

    after some investigation into my code i fixed the problem

    With Browser.Document.Body
                .InnerHtml = String.Concat(.InnerHtml, "<small>", HTMLMsg, "</small><br>")
                .ScrollTop = CInt(.InnerHtml.Length() * 1000)
    .RemoveFocus()
     End With

    the .RemoveFocus () removed the focus not from the webbrowser control, but from all the form, and that was what happened

    i meant to remove focus from the webbrowser only, and not from the entire form

    so i just removed that line and all worked as expected

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.