Using a wildcard string comparison in a select case statement 
Author Message
 Using a wildcard string comparison in a select case statement

Hi -

I need to know what type of node is being clicked on in a treeview to
put up the right popup menu.  At the highest levels, the nodes are few
and the key is hardcoded as the first three case below.  Below that, I
have three more levels that may have thousands of nodes.  I pull out
the unique id integer of each record from the query and preface that
with p for project, m for mission, etc., guarenteeing a unique key for
each node.  Now how can I use that info in the select case to popup
the right menu??  Thanks in advance for any ideas!!

David

'* This only works for first three cases, does not work witht
wildcards

Select Case tvTreeView.SelectedItem.Key
    Case "TerraPoint"
      'PopupMenu mnuTerraPointPopup
      MsgBox "terrapoint"  'debug
    Case "FixedWing"
      'PopupMenu mnuFixedWingPopup
      MsgBox "fixedWing" 'debug
    Case "Helicopter"
      'PopupMenu mnuHelicopterPopup
      MsgBox "helicopter" 'debug
    Case "p*"
      'PopupMenu mnuProjectPopup
      MsgBox "project"  'debug
    Case "m*"
      'PopupMenu mnuMissionPopup
      MsgBox "mission"  'debug
    Case "u*"
      'PopupMenu mnuLidarFilePopup
      MsgBox "lidarfile"  'debug
  End Select



Sat, 24 Apr 2004 13:20:58 GMT  
 Using a wildcard string comparison in a select case statement
Select Case True
Case tvTreeView.SelectedItem.Key = "TerraPoint"
    'TerraPoint code
Case tvTreeView.SelectedItem.Key Like "u*"
    'U code
End Select

        -Andy (CEO, Dynamic Bits)
         http://dynamicbits.com


Quote:
> Hi -

> I need to know what type of node is being clicked on in a treeview to
> put up the right popup menu.  At the highest levels, the nodes are few
> and the key is hardcoded as the first three case below.  Below that, I
> have three more levels that may have thousands of nodes.  I pull out
> the unique id integer of each record from the query and preface that
> with p for project, m for mission, etc., guarenteeing a unique key for
> each node.  Now how can I use that info in the select case to popup
> the right menu??  Thanks in advance for any ideas!!



Sat, 24 Apr 2004 15:53:34 GMT  
 Using a wildcard string comparison in a select case statement
You could use the 'Mid' or the 'Left' function to determine the leftmost
character.

syntax:
- Leftchar$ = Mid(String$, Start%, Length%)
- Leftchar$ = Left(String$, Length%)


Quote:
> Hi -

> I need to know what type of node is being clicked on in a treeview to
> put up the right popup menu.  At the highest levels, the nodes are few
> and the key is hardcoded as the first three case below.  Below that, I
> have three more levels that may have thousands of nodes.  I pull out
> the unique id integer of each record from the query and preface that
> with p for project, m for mission, etc., guarenteeing a unique key for
> each node.  Now how can I use that info in the select case to popup
> the right menu??  Thanks in advance for any ideas!!

> David

> '* This only works for first three cases, does not work witht
> wildcards

> Select Case tvTreeView.SelectedItem.Key
>     Case "TerraPoint"
>       'PopupMenu mnuTerraPointPopup
>       MsgBox "terrapoint"  'debug
>     Case "FixedWing"
>       'PopupMenu mnuFixedWingPopup
>       MsgBox "fixedWing" 'debug
>     Case "Helicopter"
>       'PopupMenu mnuHelicopterPopup
>       MsgBox "helicopter" 'debug
>     Case "p*"
>       'PopupMenu mnuProjectPopup
>       MsgBox "project"  'debug
>     Case "m*"
>       'PopupMenu mnuMissionPopup
>       MsgBox "mission"  'debug
>     Case "u*"
>       'PopupMenu mnuLidarFilePopup
>       MsgBox "lidarfile"  'debug
>   End Select



Sat, 24 Apr 2004 16:41:43 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Wildcards in Select Case

2. Wildcards in Select Case

3. Select Case & Integer Comparisons

4. String Comparisons Case Sensititive?

5. Case sensitive string comparison ?

6. Ignore Case in String Comparisons

7. VBScript Select Case vs VB Select Case

8. Bitwise comparison in SELECT-statement?

9. string comparison statement

10. Select Case Statement Help

11. Select Case Statement

12. Criteria for select case statements

 

 
Powered by phpBB® Forum Software