H hbs New Member Licensed User Longtime User Dec 7, 2015 #1 I'm having issues with a Windows Mobile app using several forms and an SQLite database. I have a product details form which navigates to a product search form with a Listview control. Everything works fine the first time I show the form, but the Listview control does not seem to refresh on subsequent searches (close form and then show again). The problem is when I initialize the listview in the form.show event. Code: Sub frmSearch_Show lvSearch.New1("frmSearch",0,50,240,110) lvSearch.FullRowSelect=True coltype.New1 lvSearch.AddColumn("Code",75,0,True,coltype.NText) lvSearch.AddColumn("Description",100,0,True,colt End Sub The second time I show the form it creates another instance, since the form itself is not destroyed when closing (only hidden). I know could move the code to initialize all objects/controls needed in my app_start sub, but since the app may grow to many forms, I don't know if this is the best way. Is there a way I can check if an object is initialized before creating it, so I don't create a second instance? Any advice would be appreciated. Peter
I'm having issues with a Windows Mobile app using several forms and an SQLite database. I have a product details form which navigates to a product search form with a Listview control. Everything works fine the first time I show the form, but the Listview control does not seem to refresh on subsequent searches (close form and then show again). The problem is when I initialize the listview in the form.show event. Code: Sub frmSearch_Show lvSearch.New1("frmSearch",0,50,240,110) lvSearch.FullRowSelect=True coltype.New1 lvSearch.AddColumn("Code",75,0,True,coltype.NText) lvSearch.AddColumn("Description",100,0,True,colt End Sub The second time I show the form it creates another instance, since the form itself is not destroyed when closing (only hidden). I know could move the code to initialize all objects/controls needed in my app_start sub, but since the app may grow to many forms, I don't know if this is the best way. Is there a way I can check if an object is initialized before creating it, so I don't create a second instance? Any advice would be appreciated. Peter
JonPM Well-Known Member Licensed User Longtime User Dec 7, 2015 #2 You can track it yourself by creating a new variable, lvIsInitialized = False, then set to true when you initialize it.
You can track it yourself by creating a new variable, lvIsInitialized = False, then set to true when you initialize it.
H hbs New Member Licensed User Longtime User Dec 11, 2015 #3 Thanks for the advice, Jon. I will use this approach.
Cableguy Expert Licensed User Longtime User Dec 11, 2015 #4 You can also use the .tag property and use it as a flag