Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 104
Default Treeview Question

Hi I am using a treeview to enable the user to run code that runs a sql
query, has anyone got any idea how to prevent the user selecting another node
while the code is still running.
TIA
Charles
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Treeview Question

You could prevent users selecting another via the keyboard by doing this in
the KeyDown event:

if bSQLRunning then
KeyCode = 0
Exit Sub
end if

Preventing this is more difficult when the user uses the mouse and you will
need some code to keep track of the previously selected node and then
return to that. This couild be done with a private node variable that gets
set
in the node_click event.
So, you would get something like this:

Private oLastNode as Node

Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)

if bSQLRunning then
oLastNode.Selected = True
Exit Sub
else
Set oLastNode = TreeView1.SelectedItem
end if

Simplest would be to just set the Enabled property of the treeview
temporarily to False.


RBS


"vqthomf" wrote in message
...
Hi I am using a treeview to enable the user to run code that runs a sql
query, has anyone got any idea how to prevent the user selecting another
node
while the code is still running.
TIA
Charles


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
TreeView Stephen[_22_] Excel Programming 2 October 10th 05 06:25 PM
TreeView Help Tony Excel Programming 0 September 21st 05 05:39 PM
Treeview Patrick Choi[_2_] Excel Programming 1 September 6th 04 08:29 AM
How to Treeview in VBA kvenku[_9_] Excel Programming 1 May 27th 04 01:03 PM
Treeview Max Scott Excel Programming 2 October 3rd 03 02:00 PM


All times are GMT +1. The time now is 03:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"