B4J Question function return error for object(array value)

Tayfur

Well-Known Member
Licensed User
Longtime User
Hello everybody;

I have a function ; its working with Combobox change. And its returned object value; But it has an error return value of array.
How can i fix it?


B4X:
Sub Full_kaydi_getir(firmaadi As String) As Object
    Dim row(8) As Object=Null
    If Liste_Kisa_Ad.IndexOf(firmaadi)<0 Then
            Return row
        Else
        row=Liste_Full.Get(Liste_Kisa_Ad.IndexOf(firmaadi))
        Return row ''<<<< problem line is here********
    End If
End Sub

Sub F_Frima_ComboBox_ValueChanged (Value As Object)
    Dim row(8) As Object
    row(8)=Full_kaydi_getir(Value) '<<<< retun value
    If row<>Null Then
        F_Text_Firma_No.Text=row(1)
        F_Text_Firma_Kisaad.Text=row(2)
        F_Text_Firma_FullAd.Text=row(3)
        F_Text_Firma_Adres1.Text=row(4)
        F_Text_Firma_Adres2.Text=row(5)
        F_Text_Firma_web.Text=row(6)
        F_Text_Firma_telefon.Text=row(7)
    Else
            
    End If
    
End Sub

Waiting for debugger to connect...
Program started.
ok
PC1
Windows 10
1.8.0_152
Satırda hata oluştu: 77
java.lang.ArrayIndexOutOfBoundsException
at java.lang.reflect.Array.set(Native Method)
at anywheresoftware.b4a.shell.ArraysUtils.setElement(ArraysUtils.java:84)
at anywheresoftware.b4a.shell.Shell.setArrayElement(Shell.java:477)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:266)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:159)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:90)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:93)
at anywheresoftware.b4a.BA$1.run(BA.java:215)
at com.sun.javafx.application.PlatformImpl.lambda$null$172(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$173(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
at java.lang.Thread.run(Thread.java:748)
 

stevel05

Expert
Licensed User
Longtime User
When you do

B4X:
 Dim row(8) As Object
    row(8)=Full_kaydi_getir(Value) '<<<< retun value

You have indexes 0 to 7 available, so I would guess the line should be:

B4X:
 Dim row(8) As Object
    row(7)=Full_kaydi_getir(Value) '<<<< retun value
 
Upvote 0
Top