Hi guys, I’d like to know if there’s something I can set in the properties of the Company Progress and Schedule windows, or change the code to prevent them from opening accidentally. The Company Progress and Schedule windows open after I answer the question. I’m probably wrong about the logic. I just wanted to perform some background operations on the windows, but they still open.
If MsgBox(" ...eliminarla ?? ", 36, "Attenzione...") = 6 Then
AndamentoDitta.EliminaDaScadenziario(magazzino.txtfield1(3).Text.ConvertEncoding(Encodings.UTF8),ConvertDateItalianToSql(magazzino.txtfield1(4).Text).SQLDate+" 00:00:00",magazzino.txtfield1(5).Text.ConvertEncoding(Encodings.UTF8)) ' (Chi, Quando, Documento)
if Scadenziario.Visible=True then
call Scadenziario.PressioneSuiPulsantiDiRicerca()
end if
else
return
end if
This is the first time this has happened to me. I usually leave Behavior->Visible = True.
Now I’ve disabled it, and the part of the code that was giving me problems works, and it works even if I call the window directly. Why?
Is “Scadenziario” the name of a window you have created? You likely have ImplicitInstance turned on. When you reference the window my name, if it doesn’t exist it creates one. So then “if Scadenziario.Visible=True then” will cause the window to show if it doesn’t already exist.
Click on the window and then click on the cog icon in the inspector, turn off Implicit Instance.
You will then have to change your code to use a reference to the window, rather than the name of it.
Create a property somewhere in your app to hold the reference to the window. Either in the App class or a module. Make sure it’s public.
When you open the window store a reference to the window like so:
Class App
Property oScadenziario as Scadenziario
End class
App.oScadenziario = New Scadenziario
Now when you want access the window use App.oScadenziario rather than just Scadenziario.