| View previous topic :: View next topic   | 
	
	
	
		| Author | 
		Message | 
	
	
		Blader I post too much
  Reputation: 2
  Joined: 19 Jan 2007 Posts: 2049
 
  | 
		
			
				 Posted: Wed Nov 14, 2007 4:53 pm    Post subject: VB6 Combo Box | 
				       | 
			 
			
				
  | 
			 
			
				I need help making a combo box (drop down menu)
 
I already set it up, and what I want is when I click something in the menu, it does something
 
 
Like this:
 
 
When I click option1
 
Do something
 
When I click option2
 
Do something
 
When I click option3
 
Do something
 
End Sub
 
 
I just need the "When I click option" thingy
 
The options I have are
 
High, Medium, Low
 
 
Thanks   
 _________________
  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Pseudo Xero I post too much
  Reputation: 0
  Joined: 16 Feb 2007 Posts: 2607
 
  | 
		
			
				 Posted: Wed Nov 14, 2007 5:06 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				I don't know if VB6 has it, but use the "SelectedIndexChanged" event, and then you can use Select Case on ComboBox.Text.
 _________________
  	  | haxory' wrote: | 	 		  can't VB do anything??
 
windows is programmed using VB right? correct me if im wrong.
 
 
so all things in windows you have like the start menu is a windows form too. | 	 
  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		Blader I post too much
  Reputation: 2
  Joined: 19 Jan 2007 Posts: 2049
 
  | 
		
			
				 Posted: Wed Nov 14, 2007 5:24 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Nvm I got it, found something in google =)
 _________________
  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		TheIndianGuy Advanced Cheater
  Reputation: 102
  Joined: 14 Jan 2007 Posts: 88
 
  | 
		
			
				 Posted: Wed Nov 14, 2007 5:29 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				 	  | Blader wrote: | 	 		  | Nvm I got it, found something in google =) | 	  
 
 
now your learning!  
 | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		atom0s Moderator
  Reputation: 205
  Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
  | 
		
			
				 Posted: Wed Nov 14, 2007 5:39 pm    Post subject:  | 
				       | 
			 
			
				
  | 
			 
			
				Quick example if anyone else requests:
 
 
 	  | Code: | 	 		  Option Explicit
 
 
Private Sub Form_Load()
 
'--------------------------
 
' Add Items To Combo Box
 
'--------------------------
 
    Combo1.AddItem "Item 1" '// List Index 0
 
    Combo1.AddItem "Item 2" '// List Index 1
 
    Combo1.AddItem "Item 3" '// List Index 2
 
End Sub
 
 
Private Sub Combo1_Click()
 
    Select Case Combo1.ListIndex
 
        Case 0
 
            MsgBox "Item 1 selected"
 
        Case 1
 
            MsgBox "Item 2 selected"
 
        Case 2
 
            MsgBox "Item 3 selected"
 
    End Select
 
End Sub | 	  
 _________________
 - Retired.  | 
			 
		  | 
	
	
		| Back to top | 
		 | 
	
	
		  | 
	
	
		 |