× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am using Visual Basic more and more in my work.  I highly recommend it to
AS400 pgmrs to broaden their skills and marketability.  But definitely,
buyer beware.  Here is a story of a bug and microsoft's response to it.


A one line description of the bug:
   VB6.0 bug:  a ByRef argument does not set its reference to a class public
property.

A fuller explanation follows. But in as400 speak, it means that when I call
an ILE function with a ByRef parameter and pass a field from a rcdfmt, the
returned ByRef parameter value is dropped, with the caller getting blanks
when it should get a return value. But call the function with a standalone
field and the ByRef parm does return the value correctly.

I call Microsoft tech support using 1 of my 2 free tech support instances.
I email my code, they run it, acknowledge the bug, agree that the bug is
occuring in a core component of VB and tell me I will not be charged for my
call ( decremented ) .  Then they tell me that there is no public
documentation of the bug, that there will not be any in the future and that
the bug will not be fixed in VB6.0 .  ( it is fixed in VB.NET ).

Not only will they not fix the bug, they will not even document it.


Steve Richter



Here is a full description:


In VB you can create a class. At its simplest, you can use a class just like
you use a rcdfmt in rpg. Here is such a simple class:

'The class name is AcDemo1.  So this class code is placed in a class module
( srcmbr )
'the class will contain 2 public properties ( fields )
   Public sName as String
   Public sAddr as String



Now I code a Sub Procedure. ( ile function ).  Arg 2 of the procedure is
passed "ByRef". This is the same as in ILE.  A ByRef argument can receive a
value on the call, and return a value when the Sub Procedure ends.
This procedure will simply return with Arg2 = Arg1.
  Public Sub CopyArg1ToArg2( sValue as string, ByRef sRtnVlu as String )
    sRtnVlu = sValue
  End Sub


Next I code some mainline code that declares an instance of the class and
calls the sub:
  Dim demo1 as New AcDemo1
  Dim sDoesWork as String

  CopyArg1ToArg2( "abc", sDoesWork )
  MsgBox sDoesWork            'this works. sDoesWork = "abc"

  CopyArg1ToArg2( "abc", demo1.sName )
  MsgBox demo1.sName           'does not work. demo1.sName = ""




As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.