Results 1 to 2 of 2

Thread: ListIndex

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2003
    Location
    World!
    Posts
    112

    ListIndex

    Hello all. I have a list box and a command button. I want to highlight an item in the list box then click the command button and it will open a certain site? How do I do this? Thanks in advance I really appreciate the help :>)
    Have A Good Day

  2. #2
    Fanatic Member Illspirit's Avatar
    Join Date
    Mar 2001
    Location
    Blackpool, England
    Posts
    815
    add a command button and a listbox, and this...

    VB Code:
    1. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
    2.  
    3. Private Sub Form_Load()
    4.    
    5.     List1.AddItem "http://www.google.co.uk"
    6.     List1.AddItem "http://www.vbforums.com"
    7.     List1.AddItem "http://www.smartbarxp.com"
    8.    
    9.     Command1.Caption = "Go"
    10.    
    11. End Sub
    12.  
    13. Private Sub Command1_Click()
    14.  
    15.     ShellExecute Me.hwnd, "open", List1.List(List1.ListIndex), vbNullString, vbNullString, 1
    16.    
    17. End Sub
    Illspirit - [email protected]

    SmartBarXP Lead Developer
    SmartBarXP - The leading desktop sidebar application for Microsoft Windows XP

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width