Unloading controls


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Unloading controls

  1. #1
    Join Date
    Aug 2004
    Posts
    43,023

    Unloading controls

    [Originally posted by Philip Zachariah]

    Dear Friends, I have a problem with forms and command buttons, How far i can able to explain , i am not sure, I will try my best to explain the problem,

    I Have Three forms, Frm1,Frm2 and Frm3, In Frm1 i have Textbox, when the keydown event at this text box, Frm2 opened as Show 1. Which contain a Listview with Records, When i double clik the list item in listview, it will be place at Frm1 Text box. This part no problem, i have one more command button in this Frm2, This i use when i dont find the name in this listview, clk this button' unload frm2, brings Frm3 ,and in this form i have 6 command buttons Add DEletl Edit Cancel , like that, when i clk Exit button on this form˙ this form will be unloaded and frm2 will appear,(as Show 1) till now no problem, but if repeat the action, that is, clk the button in frm2, when this time frm3 appears, but, i see the Exit commanbutton only as a Gray Block, doest have any caption or nothing, and sometimes disappears.(all other cmdbuttons are appears correctly in frm3)
    Why sometimes when unloadsome forms, its not unloading correctly, all details can seen behind the form
    Can any one help me please...........

    Thanks in Advance
    Philip Zachariah

  2. #2
    Join Date
    Aug 2004
    Posts
    43,023

    Re:Unloading controls

    [Originally posted by Nick Dawkes]

    I don't exactly follow what you are trying to do. But as a general principle, in a smaller project like this do not load and unload forms as this take a lot of time and hassle. Instead of unload, use the hide method. The show method will then make it visible again.
    So I would create a bas module with a sub main and amend my project so that sub main is the start up.
    Public sub main
    'load the forms
    load form1
    load form2
    load form3
    'show first form
    form1.show
    end sub

    change your unload statements to form3.hide etc.

    create another sub in the bas module

    Public sub closedown
    'close all database connections
    ....
    'unload all forms
    ....
    exit sub
    and call this from your exit option on form1 or wherever it is
    Hope this helps
    Nick

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center