[Gambas-devel] a patch to vb component

Daniel Campos daniel.campos at ...103...
Sun Feb 29 21:23:26 CET 2004


El dom, 29-02-2004 a las 20:46, Benoit Minisini escribió:
> On Sunday 29 February 2004 20:39, Daniel Campos wrote:
> > Hi:
> >
> >
> > I've added vb.Mid, vb.Left and vb.Right to vb.c.
> >
> > Regards,
> 
> Hi,
> 
> Funny! But why did you add them ? The Left$, Right$ and Mid$ functions of 
> Gambas are compatible with the VB ones (they are just more powerful).
> 
 Well, a long story, I had some code in which parameters for these
functions could be incorrect, and I had to return an error message to
user, so, using values like -1 for Left, or 0 as 'Start' for Mid should
be OK for Gambas, but not for VB. 

If anybody tries to translate a program for VB to Gambas, and these
functions (or other) does not work exactly in the same way,he can find
extrange results (probably in functions that the programmer didn't
protected correctly). 

 In my case,there was about a hundred points in the program, protected
with 'on error resume next', 'If Err.Number<>0 ...', that didn't work
correctly in Gambas!, so I had two options: writing a 'wrapper' in
Gambas code like:

PUBLIC FUNCTION VB_LEFT(Str As String, Lenght As Integer)

	if (Length < 1)
	... error

 Or improve that VB component :-)

 (Of course Gambas is not VB, but these little things can make the
transition easier)

Regards,

Daniel Campos
  


> Regards,





More information about the Devel mailing list