|
-
May 6th, 2005, 10:26 PM
#1
Thread Starter
Lively Member
Casewhere I don't understand this...
OK, its time for another noobish question, and its about Casewhere structures. Now back in VB6 I managed to get a casewhere structure working successfully, but by now I don't know how.
My Problem: I have a Combo Box on my form with a Collection of around 380 objects. I need to store specific variables under each selection in the Collection and I feel that casewhere is better than:
VB Code:
If cboObject.WhateverItemSelected = True Then
Do This
Else If cboObject.WhateverItemSelected = True Do This
Else If cboObject.WhateverItemSelected = True Do This
Else If cboObject.WhateverItemSelected = True Do This
'And this goes on for all objects
End If
So basically, casewhere would be better right? I could make a DB but I only have FileMaker and I haven't the slightest clue on how to implement a DB made in FM into a program. I'm not even at that level yet in VB.NET book! So anyway, How do I make a casewhere Thanks...
Last edited by martw; May 6th, 2005 at 10:27 PM.
Reason: Slight Error.
-
May 6th, 2005, 10:32 PM
#2
Re: Casewhere I don't understand this...
VB Code:
Select Case Me.ComboBox1.SelectedIndex
Case 1
'do your stuff
Exit Select
Case 2
'do your stuff
Exit Select
End Select
-
May 6th, 2005, 10:55 PM
#3
Re: Casewhere I don't understand this...
Dont forget the Case Else 
VB Code:
Select Case Me.ComboBox1.SelectedIndex
Case 1
'do your stuff
Case 2
'do your stuff
Case Else
'when all other options are not matched
End Select
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 6th, 2005, 10:56 PM
#4
Thread Starter
Lively Member
Re: Casewhere I don't understand this...
Dude, that little animation in your sig is awesome 
So basically, I HAVE to use Case 1, Case 2, Case 3 for all of my 380 or so entries in the collection? Why can't I use the text of the entry selected?
-
May 6th, 2005, 11:00 PM
#5
Re: Casewhere I don't understand this...
you can still use the text you select in your combobox
VB Code:
select case combobox1.selecteditem
'blah blah..
end case
-
May 6th, 2005, 11:02 PM
#6
Re: Casewhere I don't understand this...
You can also use a range...
VB Code:
Select Case Me.ComboBox1.SelectedIndex
Case 1 To 100
'do your stuff
Case 101 To 200
'do your stuff
Case Else
'when all other options are not matched
End Select
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
May 6th, 2005, 11:39 PM
#7
Thread Starter
Lively Member
Re: Casewhere I don't understand this...
Thanks that helped 
Man, that little fighting guy is awesome!... Why doesn't he try the door knob?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|