VB6 Component Design Question

Results 1 to 2 of 2

Thread: VB6 Component Design Question

  1. #1
    Join Date
    Dec 1969

    Default VB6 Component Design Question

    I&#039;m writing a VB6 component for an inventory system. The component will be used in ASP and in a VB6 Application and perhaps in other ways in the future. <BR><BR>The component has 4 classes and about 60 Methods/Properties. <BR><BR>I&#039;m not sure how to proceed with Error reporting. I&#039;m split between two ways: <BR><BR>1) Have the function return True if successful, False otherwise. If the function actually returned a string or array it would return data if successful and False otherwise. <BR><BR>If it returned false you&#039;d have to code to retreive the Last Error from a Dictionary object which would store the last 20-or-so errors. This would look something like this: <BR><BR>If MyObj.Method(Blah,Blah) = False Then<BR> MyVar = MyObj.GetLastError<BR>Else<BR> &#039;Do something<BR>End If<BR> <BR>2) Have the function return True or Data if successful and have it return the actual error if unsuccessful. The error it would return would be in a standard format so you could write a function (or I could include one in the DLL) to see if it is an error. It would look something like this:<BR><BR>MyVar = MyObj.Method(Blah,Blah)<BR>If MyObj.IsError(var) Then<BR> &#039;Write out error<BR>Else<BR> &#039;Do Something<BR>End If<BR><BR><BR>I can&#039;t decide which way i like better... what would you do?

  2. #2
    Join Date
    Dec 1969

    Default RE: VB6 Component Design Question

    What if the function returns true or false? If the function is going to return status I&#039;d make it return success or failure. Pass any other data through byRef variables. <BR><BR>I&#039;d probably just have the component log the actual error to a file and return false. The user probably doesn&#039;t care to interpret the error message and just needs to know that something went wrong.

Posting Permissions

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