Source code errors in the v5 PortBase script example


<< Problems with Path inform ...
Back to Portfolio FAQ index
Portfolio program window ... >>

Incorrect Drive1_Change code.

The script fails when the PC has drives with Volume Names (e.g. calling C: drive 'Bob'). When the DriveListBox on Forms OpenFile, SaveFile and SelectFolder are accessed:

Private Sub Drive1_Change()
    File1.Path = Dir1.Path  ' Set file path.
End Sub

...the process fails with "Path not found" (Error 76) as the code above fails to strip the volume name (e.g. Bob) from the returned value. The code normally recommended for this function is:

Private Sub Drive1_Change()
    ' The Drive property also returns the volume label so trim it.
    File1.Path = Left$(Dir1.Path, 1) & ":\"  ' Set file path.
End Sub

Actually, either the Left$ or Left function may be specified (Left$ explicitly takes a String variable argument, Left a Variant)


Incorrect code in GetKeywords_Click event.

The Get Keywords function has an error in the code:

 
Private Sub GetKeywords_Click()
    Dim i As Integer
    Dim sValue As String
    Dim fSize As Integer
    FieldList.Clear
    fSize = PortGal.SelectedRecords(1).Field("Keywords").MVDataCount  
        For i = 1 To fSize
        On Error Resume Next
        sValue = PortGal.SelectedRecords(1).Field("Keywords").GetMVData(i)
        FieldList.AddItem sValue
    Next
End Sub

MVDataCount returns a Long, so the function code should be:

 
Private Sub GetKeywords_Click()
    Dim i As Integer
    Dim sValue As String
    Dim fSize As Long 'Note amended code
    FieldList.Clear
    fSize = PortGal.SelectedRecords(1).Field("Keywords").MVDataCount  
        For i = 1 To fSize
        On Error Resume Next
        sValue = PortGal.SelectedRecords(1).Field("Keywords").GetMVData(i)
        FieldList.AddItem sValue
    Next
End Sub

Unintended (?) inclusion of Visual SourceSafe (.SCC) files with source code files.

The 'PortBase' and 'Find Duplicates' source code folders both include SCC files for Visual Source safe which are inappropriate for public distribution. VSS is part of Visual Studio but not Visual Basic, for which this distribution is intended. The SCC files contain information about Extensis' server folder structures which is not relevant for outside developers.

Although the same sample scripts ship with v6, no source code was shipped and there appears to be not intention to do so. It does appear however, that the scripts are the v5.01 code compiled using VB6.



Question: Source code errors in the v5 PortBase script example [FAQ00099.htm]
Last Update:- 01 June 2006


<< Problems with Path inform ...
Back to Portfolio FAQ index
Portfolio program window ... >>

Quick Search of PortfolioFAQ (word, words or phase): or try the Advanced Search

User-to-User Forums  |  Report error/typo/broken link  |  Request new topic  |  Ask a question

Site and articles © Mark Anderson 2001-2007 - Visit my home page


This FAQ is created and maintained using
Friday logo
Friday - The Automatic FAQ Maker