I am a novice XOJO programmer with C, Java, C++ … experience but basic knowledge of XOJO programming…
Let’s explain my new problem:
I have a Window (MyWindow) with a ListBox (ListBox1) and one TextField (TextField1). Textfield1.Visible = False.
I want to create additional TextFields at runtime based on the number of columns in ListBox1. This is done in a loop (i is the loop index) in the Open() event of MyWindow:
Dim Tx As TextField
Tx = new TextField1
The TextFields are all displayed well. Now, I want to update the Textfields (TextField1(0), TextField1(1)… ) with the data in a row of ListBox1. I have the following piece of code in the change() event of ListBox1 (ArraySize is the number of columns in the ListBox)
Row = ListBox1.ListIndex
If Row <> -1 Then
For i As Integer = 0 To ArraySize-1
At runtime, the code breaks at the line TextField1(i).Text=ListBox1.Cell(Row,i). Debugging shows me that TextField1(1) is unknown. TextField1(0) is filled with data.
What is going wrong? Why is the array not available?
What is the exception you get on this line? I don’t see anything that looks obviously wrong but you’ve left out some parts of the code.
You might want to do this in steps. You have verified you can add the TextFields so the next thing would be to verify you can add text to all of them. Once you know that works you can add the ListBox handling you want.
Or you can post a link to your sample project so we can take a peek at it.
I don’t know what could be the problem since I haven’t seen your entire project. It would appear the problem is caused by some other code in your project (not what you’ve posted here). You certainly would get a NilObjectException if you tried to access TextFields that do not exist on the Window.