i starting to use webapp coming from desktop
i have a organisation problem, to update text areas
in desktop you do
mywindow.myTextarea.text = “put something”
but in web app,
it seems you can only do
myTextarea.text = “put something” coming from a button or an element inside the page
if it is in the app or session, or in a class
mypage.myTextarea.text = “put something”
will bring nilobjectexecption
so i’m trying from the app or the session but got nil exeption too
how do i refer to update textarea from outside the page? must be simple, excuse my noobiness
As far as I know, that could work, can you share an example project to see what’s going on?
I prefer to expose computed properties, instead of making controls public (even in desktop apps). So when you update a computed property, it will update the control.
Hope this helps.
in fact i made more tests, and use session to store my class instance
it’s a urlConnection
it’s when the content received is triggered that i want to display some text on page.
i made a small project, that crashes when the content received wants to send text to page
try this because you are inside of this class
Sub ContentReceived(URL As String, HTTPStatus As Integer, content As String) Handles ContentReceived
'Session.myClass.hisString = content
hisString = content
give this class the page object in Page Open at
it means change the construtor
and memory the page object for later user in a property.
seems you can not access the page direct by name in ContentReceived.
The strategy that I use for server-side processes like urlConnection is to create an instance of urlConnection in the Session class, and create its Events as Methods in the Session class (using AddHandler).
However, I never allow urlConnection to touch the UI. Instead, for example, my handler method for contentReceived would write received data into a pre-defined text property of the Session class. (I do this because urlConnection is asynchronous, and we never know when the content will be received.
I then have a WebTimer object that is in the WebPage class, and I set that timer running in continuous mode (1s interval, perhaps) when urlConnection is first called. The timer’s Action event looks for the text property in Session, and when that property is no longer blank, the timer can be turned off and the text can be copied from Session to a label or textArea on the webpage.
Because the timer is within the webpage class, its webpage (and therefore its textArea) are always in scope whenever the page is on display. urlConnection can do its thing, and the timer can do its thing - the two never meet. Keeping the UI separate from background processes like urConnection always seems to work well.