borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (VB6 and Access)Next Topic (an amusing coding example) New Topic New Poll Post Reply
AndreaVB Forum : VB General : VB Collection
Poster Message
cleopard
Level: Big Cheese

Registered: 02-09-2005
Posts: 28

icon VB Collection

I have something I want to code in VB where I'm checking to see if a character in a string falls into a particular group of characters and if it does, change that character to something else.  Some languages have something like an enumeration type where you can do something like:

type chars is ('/' , '|', '*');

if filename[x] in chars then
.
.

I'm wondering how best to handle that in VB.  I see something called a 'Collection' that can be dimensioned, then items can be added.  Would this be the best way to this, or is there another construct I haven't found yet?  Thank you.

07-12-2006 at 08:36 PM
View Profile Send Email to User Show All Posts | Quote Reply
vbgen
Level: Moderator

Registered: 10-10-2002
Posts: 876
icon Re: VB Collection


'validates if key entered is a NUMBER
'how to use....
'Keyascii = validateNumber(keyascii)
Public Function ValidateNumber(Source) As String
    Select Case Chr(Source)
        Case "0" To "9"
        Case Else
            If Source <> 8 Then
                ValidateNumber = 0
                Exit Function
            End If
    End Select
        'because this function should return the character pressed
        ValidateNumber = Source
End Function


can you start with this first? i mean.. try to understand this piece of code, then you might be able to think further...

i'll help you once i get home... i'm just at a cafe right now hahahaha... okidokie?

____________________________
Been busy trying to take a second degree <--it's not working out...

11-01-2007 at 07:20 PM
View Profile Send Email to User Show All Posts | Quote Reply
AndreaVB Forum : VB General : VB Collection
Previous Topic (VB6 and Access)Next Topic (an amusing coding example) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder