|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
A Question of form focus - VB.NET 2003have is a main form and a form used for display only. There are no user controls on the display form and it does not ever need to have the focus. When the displays on the form are updated it appears to get the focus. I would like to prevent this because if the user operates any hot-keys (thinking the main form still has focus) these keys will fail. I have tried saving the display form's owner in a variable and then executing the following in my UpdateDisplay method. However the focus remains with the display form, when I had hoped it would be set to the main form (the display forms owner). mOwner.Select() I have also tried: mOwner.Focus() Neither of which seem to work. Many thanks, Sid. Sid Price wrote:
Show quoteHide quote > Is there a way of stopping a form getting focus in VB.NET. The scenario I Just because you update some controls on a form it should not get focus. > have is a main form and a form used for display only. There are no user > controls on the display form and it does not ever need to have the focus. > When the displays on the form are updated it appears to get the focus. I > would like to prevent this because if the user operates any hot-keys > (thinking the main form still has focus) these keys will fail. > > I have tried saving the display form's owner in a variable and then > executing the following in my UpdateDisplay method. However the focus > remains with the display form, when I had hoped it would be set to the main > form (the display forms owner). > > mOwner.Select() > > I have also tried: > > mOwner.Focus() > > Neither of which seem to work. > > Many thanks, > Sid. > > You may want to show the code that causes the form to get focus. Chris
Show quote
Hide quote
"Chris" <no@spam.com> wrote in message This is the mothod that updates the controls on the form:news:uPR$PtjZGHA.1348@TK2MSFTNGP05.phx.gbl... > Sid Price wrote: >> Is there a way of stopping a form getting focus in VB.NET. The scenario I >> have is a main form and a form used for display only. There are no user >> controls on the display form and it does not ever need to have the focus. >> When the displays on the form are updated it appears to get the focus. I >> would like to prevent this because if the user operates any hot-keys >> (thinking the main form still has focus) these keys will fail. >> >> I have tried saving the display form's owner in a variable and then >> executing the following in my UpdateDisplay method. However the focus >> remains with the display form, when I had hoped it would be set to the >> main form (the display forms owner). >> >> mOwner.Select() >> >> I have also tried: >> >> mOwner.Focus() >> >> Neither of which seem to work. >> >> Many thanks, >> Sid. >> >> > > Just because you update some controls on a form it should not get focus. > You may want to show the code that causes the form to get focus. > > Chris Private Sub UpdateDisplay() Dim iSeconds As Integer = iValue Mod 60 Dim iMinutes As Integer = iValue \ 60 Dim strDisplay As String If iSeconds < 10 Then strDisplay = iMinutes & ":0" & iSeconds Else strDisplay = iMinutes & ":" & iSeconds End If ledCount.Text = strDisplay End Sub Sid.
Web Browser in Windows App
Unused variables that really are?!? RS232 - Recive = Send???? Debug.Wrile does not appear on the Output Window GetCurrentProcess.Id vs GetCurrentProcessId API Can't delete an image that is in a picture box Trying to execute something stored in variable Form Visibility Issue VB.NET 2003 Paste logo on image Problem with generating file shortcut in VB |
|||||||||||||||||||||||