View Full Version : so we're on the same page
EdCompSci
09-24-2006, 09:42 PM
I'm reading VBA Developer's handbook 2nd ed. by Getz and Gilbert, but don't know where to apply it. Anyone have any general or specific questions where I may assist them in finding some info in my book about it? Anyone else reading this book or have it? i've randomly opened the book at page 431, which starts chapter 8, Creating Dynamic Data Structures Using Class Modules. It starts with abstract data structures. help me get involved.
- Edward (http://www.progave.com)
Bob Phillips
09-27-2006, 08:02 AM
You want help? Start at the beginning.
EdCompSci
09-27-2006, 07:17 PM
lol thanks, but I've read already about halfway through the book and have nowhere to apply it because my employer chose someone else for the Application Analyst position they put up. I see there aren't many threads in this forum and thought maybe this would open up some kind of discussion.
EdCompSci
09-27-2006, 07:33 PM
okay though, here's something i tried from Ch. 1, real basic but it's not working. in my VB6.0 LE. What did I do wrong? Why doesn't the MsgBox show the string?
Private Sub cmdExtract_Click()
txtExtractedString.Text = Extract(txtExtractedString.Text, 4)
MsgBox txtExtractedString.Text
End Sub
Function Extract( _
ByVal strIn As String, _
ByVal intPiece As Integer, _
Optional ByVal strDelimiter As String = " ") As String
Dim astrItems() As String
On Error GoTo HandleErrors
If Len(strDelimiter) = 0 Then
' no del supplied -> return entire input string
Extract = strIn
Else
' split the string into
' an array, and return the requested piece.
' don't foregt the array returned is 0-based
astrItems = Split( _
Expression:=strIn, _
Delimiter:=strDelimiter, _
Compare:=vbTextCompare)
Extract = astrItems(intPiece - 1)
End If
ExitHere:
Exit Function
HandleErrors:
Select Case Err.Number
Case 9 ' subscript out of range
' the caller asked for a token that doesn'y
' exist. return empty string
Resume ExitHere
Case Else
Err.Raise Err.Number, Err.Source, _
Err.Description, Err.HelpFile, Err.HelpContext
End Select
End Function
mdmackillop
09-28-2006, 12:30 AM
Try as your text "The cat sat on the mat"
Bob Phillips
09-28-2006, 04:42 AM
lol thanks, but I've read already about halfway through the book and have nowhere to apply it because my employer chose someone else for the Application Analyst position they put up. I see there aren't many threads in this forum and thought maybe this would open up some kind of discussion.
Do you want to sell it?
EdCompSci
09-28-2006, 11:50 PM
Do you want to sell it? no and sorry evryone, I hadn't looked at code for a while. It works fine. I wasn't putting any spaces in my strings, which is the whole point. I'll take a thumbs down from all of you. Thanks though for the replies.
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.