I click an item from one of three table views and assign the value to a variable. I use the value to launch a form. I get an error at the End Sub.
part of the code is something like:
Sub TableView1_SelectedRowChanged(Index As Int, Row() As Object)
Dim f As Int
If Index > -1 Then
TV = 1
f = GetCellValue(Index, 0)
End If
End Sub
'''table view 2 and 3 deleted since it is almost same as table view 1 code
Sub GetCellValue(RowIndex As Int, CellIndex As Int) As String
Return GetLabel(RowIndex, "0").Text
End Sub
Sub GetLabel(RowIndex As Int, CellIndex As Int) As Label
If TV = 1 Then
Dim row() As Object = TableView1.Items.Get(RowIndex)
Main.t= row(CellIndex)
form1.show
Else if TV = 2 Then
Dim row() As Object = TableView2.Items.Get(RowIndex)
Main.t= row(CellIndex)
form2.show
Else if TV = 3 Then
Dim row() As Object = TableView3.Items.Get(RowIndex)
Main.t= row(CellIndex)
form3.show
End If
End Sub
form1 loads then I get an error on line 116 which is an End Sub
line: 116 is End Sub
Waiting for debugger to connect...
Program started.
(Exception) Not initialized
Error occurred on line: 116
java.lang.NullPointerException
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:606)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:228)
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)
part of the code is something like:
Sub TableView1_SelectedRowChanged(Index As Int, Row() As Object)
Dim f As Int
If Index > -1 Then
TV = 1
f = GetCellValue(Index, 0)
End If
End Sub
'''table view 2 and 3 deleted since it is almost same as table view 1 code
Sub GetCellValue(RowIndex As Int, CellIndex As Int) As String
Return GetLabel(RowIndex, "0").Text
End Sub
Sub GetLabel(RowIndex As Int, CellIndex As Int) As Label
If TV = 1 Then
Dim row() As Object = TableView1.Items.Get(RowIndex)
Main.t= row(CellIndex)
form1.show
Else if TV = 2 Then
Dim row() As Object = TableView2.Items.Get(RowIndex)
Main.t= row(CellIndex)
form2.show
Else if TV = 3 Then
Dim row() As Object = TableView3.Items.Get(RowIndex)
Main.t= row(CellIndex)
form3.show
End If
End Sub
form1 loads then I get an error on line 116 which is an End Sub
line: 116 is End Sub
Waiting for debugger to connect...
Program started.
(Exception) Not initialized
Error occurred on line: 116
java.lang.NullPointerException
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:606)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:228)
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)