Re: VB6 Raise Error w/ Custom Description being replaced w/ desc for e

Tech-Archive recommends: Fix windows errors by optimizing your registry



"Robb" <Robb@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0C7F6A7D-2D89-47FE-BCFD-9C0DF80E1019@xxxxxxxxxxxxxxxx
I'm using VB 6.0, Service Pack 6, on an XP machine.

I'm raising an error with a custom Description in a DLL.

Err.Rasie 106,"MySource","My Custom Description"


This seems to work fine... note that you spelled "Raise" wrong above, which
means you're typing code from memory here... which is never a good idea.
It's always best to paste the actual code so we're not spinning our wheels
over a typo.
'====================
Option Explicit

Private Sub Command1_Click()
Dim o As Class1
Set o = New Class1
On Error Resume Next
Call o.TheError
Debug.Print Err.Number
Debug.Print Err.Source
Debug.Print Err.Description
End Sub
'====================
Option Explicit

Public Sub TheError()
Err.Raise 106, "MySource", "My Custom Description"
End Sub
'====================

--
Ken Halter - MS-MVP-VB - Please keep all discussions in the groups..
In Loving Memory - http://www.vbsight.com/Remembrance.htm


.



Relevant Pages

  • Re: how do you pass string value from a form to class
    ... I tried to declare the string as public in the Form, however, it ... Option Explicit ... Private Sub Command1_Click ... Dim o As Class1 ...
    (microsoft.public.vb.general.discussion)
  • Re: Simple cascading combo boxes
    ... The row source property of the Capability combobox shows the following: ... After deleting the original Sub, I created a new one with Option Explicit at ... cboCapability then you need to requery cboCapability. ...
    (microsoft.public.access.gettingstarted)
  • Re: Drag and Drop File Name from Windows Explorer into Access Form Textbox
    ... I had also added an "Option Explicit" to the top of Dev's module. ... A2000 and above have the AddressOf operator. ... Sub sHook(Hwnd As Long, _ ... dragging and dropping a file/folder name from Windows XP Explorer into ...
    (comp.databases.ms-access)
  • Re: Workable Scatter Plot Data Points
    ... ' code in a class named Class1 ... Private Sub cht_Select(ByVal ElementID As Long, ... Dim clsChtEvents As Class1 ... Dim mnSeries As Long ...
    (microsoft.public.excel.programming)
  • Re: Workable Scatter Plot Data Points
    ... ' code in a class named Class1 ... Private Sub cht_Select(ByVal ElementID As Long, ... Dim clsChtEvents As Class1 ... Dim mnSeries As Long ...
    (microsoft.public.excel.programming)