Solved

Lost Focus of control

Posted on 2008-10-20
5
1,952 Views
Last Modified: 2012-05-05
Hello evryone,
I have a windows form on which i have 2 treeview controls and a Tab Control (with picture boxes in each tab pages)
It looks like this:
TreeView 1| Treeview 2|  tab control(Picture Box on each tab page)
One selecting every node in any tree it shows one or multiple pictures related to the item selected in the tree in the tab control.
The problem is On every select of tree node, i am creating the tab pages dynamically and loading pictures on them.
On this My foucs is lost to the tab control and picture box control.
How can i retain my focus in this case?
Thanks very much for all your help.

0
Comment
Question by:hobbesk_ati
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 16

Expert Comment

by:CuteBug
ID: 22759961
use the Focus() method of the tab control.
0
 

Author Comment

by:hobbesk_ati
ID: 22760013
I think i did not explain my problem property.
On Slecting Node:
I created tab pages dynamically and load picture box control it.
When doing so the control moves to Selected Tab Page.

But i want the TreeView to have focus on which the user clicked.
Is there anyway I can make sure that the tab page  does not get focus itself in this case.

I can do TreeView.Focus() to set back the focus on the treeview after the loading tab page is done.
But i want to avoid this as in this case, I can have many treeviews and I would not know which TreeView i should use Focus() on.

Thanks again
0
 
LVL 30

Expert Comment

by:anarki_jimbel
ID: 22763469
It is hard to tell how it's better to do that without seeng the code. However as I guess you call some "create tab page method" fro the node_click event of the tree. After calling the method you may call something like "this_tree.Focus(). And same for all others trees.
0
 
LVL 30

Accepted Solution

by:
anarki_jimbel earned 500 total points
ID: 22763483
Another possible approach is to have a modul level variable like "TreeView currentTreeView" that is assigned every time some treeview gets focus (in GotFocus event). And the procedure on creating a new tab at the completion sets the focus to the currentTreeView".
0
 

Author Comment

by:hobbesk_ati
ID: 22783714
Thanks for your suggestions.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
Introduction Although it is an old technology, serial ports are still being used by many hardware manufacturers. If you develop applications in C#, Microsoft .NET framework has SerialPort class to communicate with the serial ports.  I needed to…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question