Treeview Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

I am writting an application in outlook style which has Left Panel and a
Right Panel. I have Treeview COntrol in left panel, and I load the forms in
right panel on AfterSelect event of the treeview. I am coming across 2
problems:

1) Forms event "Activated" does not trigger. Even when I force the event
using f1.Activate, it does not execute the code inside the event.

Private Sub frm_F8000_Activated(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.Activated
' Set focus on first input capable control
Me.txtReceipt.Focus()
End Sub


2) I am trying to set the focus on one of the controls in the form, but I am
not able to do it.

If I open the form as dialogue box, not inside the panel, then I am able to
focus on the required control, but not when I load the form in the right
panel.


Here is the code that I am using to load the form in right panel.

f1.TopLevel = False
f1.Dock = DockStyle.Top
f1.FormBorderStyle = FormBorderStyle.Sizable
Me.pnlMiddle.Controls.Add(f1)
f1.Show()
f1.Activate()

Any Help will be appreciated...
 
You might need also control.Select call before doing focus.
Also, Focus returns true if succeeds. Check it.
It could be that you need first select panel and then required control

HTH
Alex
 
Back
Top