473,668 Members | 2,408 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Form Focus Issue

First of all, I am using the .NET 2.0 framework with Visual Studio
2005.

I have two forms. One is a form with a TreeView control on it (used as
a menu - kindof a favorites list) and the other is a form with a
WebBrowser control on it.

The TreeView_Click event fires up the other form with the link passed
to it via the Node. If the user clicks the TreeView and the form is
already open with that link in it, it is supposed to set focus to the
appropriate form. This does occur, but it appears that when the Click
event completes, the form with the TreeView control on it gets the
focus back. So other than the TreeView form, the proper WebBrowser form
is at the front.

How do I get the form with the TreeView to remain behind the properly
selected WebBrowser form?

Any suggestions would be appreciated.

Mark Dahl

Jan 26 '06 #1
14 1700
isn't it just me.sendtoback? form inherits from control so this should work.

tm
"Fr15ky" <sh********@gma il.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
First of all, I am using the .NET 2.0 framework with Visual Studio
2005.

I have two forms. One is a form with a TreeView control on it (used as
a menu - kindof a favorites list) and the other is a form with a
WebBrowser control on it.

The TreeView_Click event fires up the other form with the link passed
to it via the Node. If the user clicks the TreeView and the form is
already open with that link in it, it is supposed to set focus to the
appropriate form. This does occur, but it appears that when the Click
event completes, the form with the TreeView control on it gets the
focus back. So other than the TreeView form, the proper WebBrowser form
is at the front.

How do I get the form with the TreeView to remain behind the properly
selected WebBrowser form?

Any suggestions would be appreciated.

Mark Dahl

Jan 26 '06 #2
Fr15ky,

I am not aware how long you are working already with VBNet.

Quiet anoying however logical is that in Net, when you change an item in an
event, it is possible that it triggers its own or another event. (This
happens especially with the combobox, listbox and treeview)

That can change the behaviour. Are you sure that it is not that.

I hope this helps,

Cor
Jan 26 '06 #3
Toff,

I will try doing that, I was able to have it work the first time I
click the link by doing a WebBrowserForm. BringToFront,
WebBrowserForm. Activate, and WebBrowserForm. Focus in the WebBrowser
controls _Navigated Event. But once the form has been loaded, this
event no longer runs as I am just setting focus (activating, bringing
to the front) the appropriate WebBrowserForm. In my quick trial,
however, this did not work (or I am not finding the last event that is
causing the Navigator form to get the focus back.

Cor,

Honestly, I am new to .NET. I have only really been working on .NET for
about 2 weeks. It is obviously event oriented, because this problem is
specific to the MouseDown event but the KeyDown event of the TreeView
works properly.

Do you have an event that you believe would work properly for Toff's
suggestion? I would prefer an event that can be tied to the TreeView.

Thanks for the responses and the help.

Mark Dahl

Jan 26 '06 #4
Fr15Ky,

And you are sure that there (as I wrote) is not any instruction more
triggered that is done in your treeview form?

Did you debug your program?

Cor
Jan 26 '06 #5
Cor,

Here is the ONLY code around the navigator:

Private Sub tvwNavigator_Ke yDown(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles tvwNavigator.Ke yDown
If e.KeyCode = Keys.Enter Then
If Not tvwNavigator.Se lectedNode.Equa ls(Nothing) Then
ProcessNavigato rClick(tvwNavig ator.SelectedNo de)
End If
End If
End Sub

Private Sub tvwNavigator_Mo useDown(ByVal sender As Object, ByVal e
As System.Windows. Forms.MouseEven tArgs) Handles tvwNavigator.Mo useDown
tvwNavigator.Se lectedNode = tvwNavigator.Ge tNodeAt(e.X, e.Y)
ProcessNavigato rClick(tvwNavig ator.SelectedNo de)
End Sub

Other than the above code, the form only has a _Load event that fills
the TreeView, a mnuNavExit_Clic k event that closes the application and
a mnuNavLargeIcon s_Click event that will change the ImageList for the
TreeView.

So I don't know if there is anything else I should check.

Mark Dahl

Jan 26 '06 #6
FR15Ky,
tvwNavigator.Se lectedNode = tvwNavigator.Ge tNodeAt(e.X, e.Y)

In my idea will this give an action as the form get painted again.

Can you remove it and see what happens?

Cor
Jan 26 '06 #7
temporaly
Jan 26 '06 #8
Cor,

Nope that didn't work and now I have even more problems, because the
SelectedNode is not the right one.

Mark Dahl

Jan 26 '06 #9
Hi Mark,

Why do you use tvwNavigator.Mo useDown? There is an event called AfterSelect
that fires after a node in a treeview is selected. To get the newly selected
node just query the argument
ByVal e As System.Windows. Forms.TreeViewE ventArgs

of this event for e.Node.

Using mousedown as you have may well return nothing for GetNodeAt(e.X, e.Y)
if the coordinates do not map to a node.

This probably wont solve your initial problem however so can you show us the
code for

ProcessNavigato rClick()

You said above that there is no more code on the treeview form and yet i
dont see any kind of type/instance qualifier for ProcessNavigato rClick() so
i can only assume its Me.ProcessNavig atorClick?

TM

"Fr15ky" <sh********@gma il.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
Cor,

Nope that didn't work and now I have even more problems, because the
SelectedNode is not the right one.

Mark Dahl


Jan 26 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
28132
by: 'bonehead | last post by:
Greetings, I'm still something of a newbie to html/php/mysql. I have a php/html form with several fields of type "input". If the user enters improper data in a particular field and clicks the Submit button, the php script has to trap it and return a javascript error message box with an OK button. That part I've already got down. But, you know how in Visual Basic you can set the focus on the offending
3
3046
by: bradwiseathome | last post by:
I focus on controls in a web form like this: <script language="javascript"> var focusControl = null; if (document.getElementById) focusControl = document.getElementById('txtArea1'); else if (document.all) focusControl = document.all; if (focusControl && focusControl.focus) focusControl.focus();
13
1710
by: teddy.am | last post by:
I know this is stupid, but i've been trying to process a form while adding a function to the onClick event. as soon as i add the onClick event, the function is triggerred but the form doesn't POST or GET. Any help?
13
7478
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on it, a frontend and a backend. Case 1: If vba code on the frontend updates many rows (360,000) on the backend, a form's timer event (from the frontend) will stop firing until the user gives the form focus. (Note that the update itself always...
5
2433
by: Darren DeCoste | last post by:
I have an access project with a Form that has a Command button to print the current record. I would like to Print the record 3 times, changing a text field on each print. The standard code of private sub printbutton_click() DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70 DoCmd.PrintOut acSelection End sub
12
12931
by: swingingming | last post by:
Hi, in the NorthWind sample database, when clicking on the next navigation button on the new order record with nothing on the subform (order details), we got an order with nothing ordered. How can we prevent this from happening? Thanks. ming
6
2602
by: kaosyeti | last post by:
hey.... i have a duplicate record issue i could use some help with. on a form that has 2 unbound controls, txtboxyear and cboxmonth, together will automatically fill in an invisible txtboxdate that is bound to a table and has no duplicates allowed. the problem is that there are 30 or so other controls here to be filled in and if the user selects a year and month that already has a record created, she/he won't know it until access tries to...
1
1749
by: firenet | last post by:
21 function js_reply_msg(node,g_id,u_id,par_id) 22 { 23 node.innerHTML="<FORM><TEXTAREA name=\"msg_con\"><\/TEXTAREA><br><INPUT type=\"submit\" value=\"reply\"><\/FORM>" 24 node.nextSibling.nextSibling.innerHTML="" 25 } My thought is that when i clicked a link,the js function generate the Form,then get the input and deal with it.
11
5286
by: Zytan | last post by:
I have created a new form from the main form. When I close the main form with the 'x' close button, its Form.FormClosed event is run, but not the dialog's. Is this normal? It is ok / dangerous? How can I force shutdown code within the dialog's Form.FormClosed event run? Zytan
0
8462
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8586
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7405
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6209
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5682
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4384
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2792
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2028
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1787
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.