Results 1 to 6 of 6

Thread: 2 quickies

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2002
    Location
    Clemson, South Carolina
    Posts
    51

    2 quickies

    2 quick questions guys..

    1)
    whats the diff between a Public Sub & a Private Sub?

    2)
    For anything in VB to work it must be referenced to the right file right?
    I have a project that was sent to me, it contains a form and a module, when I click on References, under Tools, in VB6, I see "MISSING" before the file names a few times. The boxes are checked though.
    I'm assuming it means that the file it's referencing to is missing.
    When I highloght the "MISSING" line, I see a path at the bottom of the box ending with the file name, they're all "*.OCX" files (Active X Control)
    So is that why I get "can't find project or library" Error when i run the program?

    thanks a bunch!

  2. #2
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    1) A Public Sub can be reached from any other form of your project while Private Sub can only be reached in the form you wrote that procedure.
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  3. #3
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    Could you add the program so I can see what is happening?
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  4. #4

    Thread Starter
    Member
    Join Date
    Nov 2002
    Location
    Clemson, South Carolina
    Posts
    51
    SURE!

    here you go, this is the code assotiated with the "form"
    never used forms before! thanks for your help!
    VB Code:
    1. Private mTimerID As Long
    2.  
    3. Public Sub TimerOn()
    4.     mTimerID = SetTimer(0, 0, 5 * 1000, AddressOf TimerCallback)
    5.     If mTimerID = 0 Then
    6.         MsgBox "Unable to create the timer", vbCritical + vbOKOnly, "Error"
    7.     End If
    8. End Sub
    9. Public Sub TimerOff()
    10.     mTimerID = KillTimer(0, mTimerID)
    11.     If mTimerID = 0 Then
    12.         MsgBox "Unable to stop the timer", vbCritical + vbOKOnly, "Error"
    13.     End If
    14. End Sub
    15.  
    16. Public Sub OnTimer()
    17.     Dim code As Long
    18.     code = mEyeOneCtrl.IsConnected
    19.     If code = eNoError Then
    20.         mStateLabel = "connected"
    21.         mStateLabel.BackColor = vbGreen
    22.     Else
    23.         mStateLabel = "not connected"
    24.         mStateLabel.BackColor = vbRed
    25.     End If
    26.  
    27. End Sub
    28. Private Sub SetStatusBarText(ByVal axCode As Long)
    29.     mErrorTextLabel.Caption = mEyeOneCtrl.GetDeviceInfo("LastError")
    30. End Sub
    31.  
    32. Private Sub LoadResults()
    33.     mResultBox.Clear
    34.     Select Case (mResultViewSelector.Object)
    35.         Case "Spectrum"
    36.             LoadSpectrum
    37.         Case "TriStimulus"
    38.             LoadTriStimulus
    39.         Case "Densities"
    40.             LoadDensities
    41.    End Select
    42. End Sub
    43.  
    44.  
    45. Private Sub LoadSpectrum()
    46.     Dim alSpectrum(0 To 35) As Single
    47.     Dim alIndex As Long
    48.  
    49.     alIndex = 0
    50.     While mEyeOneCtrl.GetSpectrum(alSpectrum, alIndex) <> eNoDataAvailable
    51.         Dim alLine As String
    52.         alLine = "Spectrum[" & Format(alIndex, "000") & "]: "    'cant find project or library here, highlights,"Format"
    53.  
    54.         Dim i As Long
    55.         For i = LBound(alSpectrum) To UBound(alSpectrum)
    56.             alLine = alLine & "  |  " & Format(alSpectrum(i), "###0.000")
    57.         Next i
    58.  
    59.         mResultBox.AddItem (alLine)
    60.         alIndex = alIndex + 1
    61.     Wend
    62. End Sub
    63.  
    64. Private Sub LoadTriStimulus()
    65.     Dim alTriStimulus(0 To 2) As Single
    66.     Dim alIndex As Long
    67.            
    68.     alIndex = 0
    69.     While mEyeOneCtrl.GetTriStimulus(alTriStimulus, alIndex) <> eNoDataAvailable
    70.         Dim alLine As String
    71.         alLine = "TriStimulus[" & Format(alIndex, "000") & "]: "
    72.        
    73.         Dim i As Long
    74.         For i = LBound(alTriStimulus) To UBound(alTriStimulus)
    75.             alLine = alLine & "  |  " & Format(alTriStimulus(i), "###0.000")
    76.         Next i
    77.                
    78.         mResultBox.AddItem (alLine)
    79.         alIndex = alIndex + 1
    80.     Wend
    81. End Sub
    82.  
    83. Private Sub LoadDensities()
    84.     Dim alDensities(0 To 3) As Single
    85.     Dim alIndex As Long
    86.     Dim alAutoDensityIndex As Long
    87.    
    88.     alIndex = 0
    89.     While mEyeOneCtrl.GetDensities(alDensities, alAutoDensityIndex, alIndex) <> eNoDataAvailable
    90.         Dim alLine As String
    91.         alLine = "Densities[" & Format(alIndex, "000") & "]: "
    92.        
    93.         Dim i As Long
    94.         For i = LBound(alDensities) To UBound(alDensities)
    95.             Dim tmp As String
    96.             tmp = Format(alDensities(i), "###0.000")
    97.             If i = alAutoDensityIndex Then
    98.                 tmp = "<" & tmp & ">"
    99.             End If
    100.             alLine = alLine & "  |  " & tmp
    101.         Next i
    102.                
    103.         mResultBox.AddItem (alLine)
    104.         alIndex = alIndex + 1
    105.     Wend
    106. End Sub
    107.  
    108. Private Sub mCalibrateButton_Click()
    109.     SetStatusBarText mEyeOneCtrl.Calibrate
    110. End Sub
    111.  
    112. Private Sub mMeasureButton_Click()
    113.     If mEyeOneCtrl.TriggerMeasurement <> 0 Then
    114.          mErrorTextLabel.Caption = mEyeOneCtrl.GetDeviceInfo("LastError")
    115.          MsgBox "mesurement failed"
    116.          Exit Sub
    117.     End If
    118.    
    119.     LoadResults
    120.    
    121. End Sub
    122.  
    123. Private Sub mMeasurementModeSelector_Change()
    124.     SetStatusBarText mEyeOneCtrl.SetOption("MeasurementMode", mMeasurementModeSelector.Object)
    125.     LoadResults
    126. End Sub
    127.  
    128. Private Sub mResultViewSelector_Change()
    129.     LoadResults
    130. End Sub
    131.  
    132. Private Sub UserForm_Initialize()
    133.     TimerOn
    134.    
    135.     mMeasurementModeSelector.AddItem ("SingleReflectance")
    136.     mMeasurementModeSelector.AddItem ("ScanningReflectance")
    137.     mMeasurementModeSelector.AddItem ("SingleEmission")
    138.     mMeasurementModeSelector.ListIndex = 0
    139.    
    140.     mResultViewSelector.AddItem ("Spectrum")
    141.     mResultViewSelector.AddItem ("TriStimulus")
    142.     mResultViewSelector.AddItem ("Densities")
    143.     mResultViewSelector.ListIndex = 0
    144.    
    145.     Dim alSubstrate(0 To 35) As Single
    146.     Dim i As Long
    147.     For i = LBound(alSubstrate) To UBound(alSubstrate)
    148.         alSubstrate(i) = 1
    149.     Next i
    150.     Dim code As Long
    151.     code = mEyeOneCtrl.SetSubstrate(alSubstrate)
    152.    
    153.     OnTimer
    154. End Sub
    155.  
    156. Private Sub UserForm_Terminate()
    157.     TimerOff
    158. End Sub

  5. #5
    Frenzied Member Tec-Nico's Avatar
    Join Date
    Jun 2002
    Location
    México
    Posts
    1,192
    Ahhh.. I see you are missing a Reference... The same would happen to me when I forgot to add a reference to the MSScript control.

    What I ignore is which of all the references is missing... I don't know where format would fit.

    Anyway, what I meant was that you should zip and upload the project so we could check it, test it, move some things and then find an answer...
    We miss you, friend... Rest in Peace, we will take care of the rest of it.

    [vbcode]
    On Error Me.Fault = False
    [/vbcode]
    - Silence is the human way to share ignorance
    Tec-Nico

  6. #6

    Thread Starter
    Member
    Join Date
    Nov 2002
    Location
    Clemson, South Carolina
    Posts
    51
    a million thanks Tec-Nico

    i included the XLS file (with all the code)

    and the DLL that youll need to reference to is about 500,000 bytes when zipped, so it wouldnt let me post it,
    not sure if you can do much without referencing to the DLL file


    thanks again!
    Attached Files Attached Files

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width