loadin a form

Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Jun 2007
Posts: 52
Reputation: anud18 is an unknown quantity at this point 
Solved Threads: 0
anud18 anud18 is offline Offline
Junior Poster in Training

loadin a form

 
0
  #1
Jun 11th, 2007
hi....actually wen i am loading a form from the module.....its loaded but its not holding on to the screen and it is performing the actions listed in the form load procedure......can anyone tell me what should i do to make the form hold on to the screen....it would be of great help....thanx...
Reply With Quote Quick reply to this message  
Join Date: Nov 2006
Posts: 848
Reputation: QVeen72 is on a distinguished road 
Solved Threads: 120
QVeen72's Avatar
QVeen72 QVeen72 is offline Offline
Practically a Posting Shark

Re: loadin a form

 
0
  #2
Jun 11th, 2007
Hi,

Are u sure Form's Visible = True...?
Instead of calling a Form In Module, Do it the other way-round.
Change the Start-Up Form To the First Form,
and in that Form-Load, Call the Module Procedure.

Regards
Veena
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 166
Reputation: AV Manoharan is an unknown quantity at this point 
Solved Threads: 9
AV Manoharan AV Manoharan is offline Offline
Junior Poster

Re: loadin a form

 
0
  #3
Jun 11th, 2007
First try to understand why a form is loaded (made visible). It is either to attract the user with some message or for some input/selection. You are not supposed to write any code other than that in the form load event. Only a control in the form if activated by the user or if it elapse in time in its visibility, then only other procedures should start.
In assence a form actually is a tool to invite the participation of the user for a specific action/s he or she wants to do. Keep that in mind while writing the code inside the form_load. Check up the code inside the form_load(). You will find the actual bug.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 166
Reputation: AV Manoharan is an unknown quantity at this point 
Solved Threads: 9
AV Manoharan AV Manoharan is offline Offline
Junior Poster

Re: loadin a form

 
0
  #4
Jun 11th, 2007
And also you should SetFocus to some of the controls in the so called form_load.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 166
Reputation: AV Manoharan is an unknown quantity at this point 
Solved Threads: 9
AV Manoharan AV Manoharan is offline Offline
Junior Poster

Re: loadin a form

 
0
  #5
Jun 11th, 2007
Take out the codes for db connection and recordset from the called form_load and paste it in the module before the form_load line. When the form_load is invoked from that module control is passed to that form_load(). The recordset is still avilable to you in the just loaded form. open it. Read the required data from the database. Fill the data on the different contols in the form and set focus to any control in the form. There you are.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 52
Reputation: anud18 is an unknown quantity at this point 
Solved Threads: 0
anud18 anud18 is offline Offline
Junior Poster in Training

Re: loadin a form

 
0
  #6
Jun 11th, 2007
thank you so much sir.....it almost worked out...but it is showing an error "object required " alongside when the form is opened.....when i try to debug it...it takes the control in the form where i am accessing the record set....
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 166
Reputation: AV Manoharan is an unknown quantity at this point 
Solved Threads: 9
AV Manoharan AV Manoharan is offline Offline
Junior Poster

Re: loadin a form

 
0
  #7
Jun 11th, 2007
Natuarally I thought it will happen. First try to declare the variable cnn and recordset as a global varaible so that from any sub you can access them.
Otherwise. you can do one thing. In the module where you invoked the form_load() just pass the recordset to the form_load.
Example
formx_load myRecordeSet

and in the form_load module

Private Sub Formx_Load(myRecordSet)

if both variable are same it is OK

Now I will tell you one simple debugging technique.

Put as many MsgBox in the program where you find you are struck up.
for example in you module where you are trying to accee the form_load
place this line.

MsgBox "I have set up the connection and passed the recordset to the formload "
then place the code

formx_load myRecordSet

Then in the
Private Sub Formx_load(myRecordSet)

MsgBox "I am inside the formx_load and I got the recordset and now I am going to open it"

then Open the record set and select the fields from the Database.
again give

MsgBox "Now I have read the data"

Likewise you can debug beautifully
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 52
Reputation: anud18 is an unknown quantity at this point 
Solved Threads: 0
anud18 anud18 is offline Offline
Junior Poster in Training

Re: loadin a form

 
0
  #8
Jun 11th, 2007
i have tried the above given procedure also....but the problem still remains the same ...that is the form which i am calling from the module isnt holding on the screen......the control immediately passes on to the next step in the module....
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 166
Reputation: AV Manoharan is an unknown quantity at this point 
Solved Threads: 9
AV Manoharan AV Manoharan is offline Offline
Junior Poster

Re: loadin a form

 
0
  #9
Jun 11th, 2007
I am very sorry to keep you so long. I have been out.
The only alternative thing can be some thing wrong with your
formx.show
To get hold of the consecutive forms you had to mention with the sow the model

Formx.Show vbModel

Revert the code to the earlier state and change the show in this way.
I think it has to work.
Get back to me immediately if it works or tomorrow I will try to help you.
Reply With Quote Quick reply to this message  
Join Date: Jun 2007
Posts: 52
Reputation: anud18 is an unknown quantity at this point 
Solved Threads: 0
anud18 anud18 is offline Offline
Junior Poster in Training

Re: loadin a form

 
0
  #10
Jun 12th, 2007
i am thankful to you sir for taking such interest.....i have tried
Formx.Show vbModel also but its not working out
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Visual Basic 4 / 5 / 6 Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC