Le 15/01/2017 à 18:31, מיוסט שרון a écrit : > hello > > I have WebForm1 > I put on the WebForm1 two controls of WebButton1 WebButton2 > I have a variable of type String named my_A > I would like when I press the WebButton1 the my_A = "sharon" and when I click > on > WebButton2 I want to get the value found in my_A > > > The problem that when I click on WebButton2 > The value of the variable my_A is empty "" > > It's what's inside that WebForm1.class > > ' Gambas class file > > Export > Private my_A As String > > Public Sub WebButton1_Click() > > my_A = "sharon" > > End > > Public Sub WebButton2_Click() > > WebButton2.Text = my_A > > End >
Yes, this is the main difference between a "normal" application (one process that runs continuously) and a "webform" application (one process by request). With a web application, the only way to keep things persistent is using the Session object. With a WebForm, you can store permanent things by using it like an array, which use internally the Session object of course. So you can write: Export Public Sub WebButton1_Click() Me["my_A"] = "sharon" End Public Sub WebButton2_Click() WebButton2.Text = Me["my_A"] End So, never forget that your application is a web application that is not persistent between two events (the request is mostly the full handling of one event coming from the web browser. The response is the refresh of the web browser contents). Regards, -- Benoît Minisini ------------------------------------------------------------------------------ Developer Access Program for Intel Xeon Phi Processors Access to Intel Xeon Phi processor-based developer platforms. With one year of Intel Parallel Studio XE. Training and support from Colfax. Order your platform today. http://sdm.link/xeonphi _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user