Re: [Gambas-user] Class array - Null Object
Brought to you by:
gambas
|
From: Benoît M. <g4...@gm...> - 2018-01-29 06:05:51
|
Le 29/01/2018 à 05:53, Phan Damily via Gambas-user a écrit : > Hello everyone. I'm new to Gambas and new to the mailing list. I'm using v3.10.0 on Linux.I programmed extensively with VB6 back in the day. So Gambas is pretty straight-forward and I'm excited about switching over from Xamarin's C#. > > But I've ran into a situation with Gambas I can't resolve. I've been testing code ideas, trying to create a working one-dimensional class array. But keep getting "Null object" errors when trying to assign values to fields. > ' Class1.class > Public I As Integer > Public S As String > ' FMain.class Public TheArray As New Class1[] > > Public Sub cmdTest_Click() > Dim TheCounter As Integer > TheArray = New Class1[] > TheArray.Resize(100) For TheCounter = 0 To 100 > TheArray[TheCounter].I = TheCounter <---- Null object in FMain > TheArray[TheCounter].S = CStr(TheCounter) > Next > For TheCounter = 0 To 100 > Print TheArray[TheCounter].I, TheArray[TheCounter].S > NextEnd > > I'm sure the solution is pretty simple. But I haven't been able to find an answer or a working code example for this particular situation. Thanks for reading. > ------------------------------------------------------------------------------ > Check out the vibrant tech community on one of the world's most > engaging tech sites, Slashdot.org! http://sdm.link/slashdot > _______________________________________________ > Gambas-user mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gambas-user > Please post to the new mailing-list at http://lists.gambas-basic.org. This mailing-list is now deprecated. Thanks. -- Benoît Minisini |