Stupid Object declaratoin question

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

I am so stupid that Got a object declaration question, Anyone, please be
kind to reply me.

I got a datagrid which got a button in each row , the user will do the
searching in it,
If the user do the searching, I will decarre a form and show it. ( as
follow)
1st) Dim frmSearch as New frmCompanySearch
2nd) frmSearch.setting= myObjectSetting
3rd) frmSearch.showdialog()

Now I am confuse that datagrid contains many many rows, if the user process
the above code, it seems It will declare many many frmSearch object, right
?? Will it waste resources ???

I think I can decalre 1st) line once , and put 2nd) line in form_load() ,
right ??
Anydifference ??

Thanks for your kind reply.
 
What grid are you using? Standard datagrid doesn't have buttons, but others
do in which case it will send key information with that button. You want to
declare it when the button is clicked itself... Well, maybe you do, it
kinda depends on the application, you could have it so the form is declared
only once, and you declare as a class level variable, then upon changing
rows, you call a procedure to update the form
 
Hi,

When you use showdialog the procedure showing the form waits
until the form closes before going to the next line of code. The garbage
collector should dispose of the used frmsearch when the procedure is done.

Ken
------------------
I am so stupid that Got a object declaration question, Anyone, please be
kind to reply me.

I got a datagrid which got a button in each row , the user will do the
searching in it,
If the user do the searching, I will decarre a form and show it. ( as
follow)
1st) Dim frmSearch as New frmCompanySearch
2nd) frmSearch.setting= myObjectSetting
3rd) frmSearch.showdialog()

Now I am confuse that datagrid contains many many rows, if the user process
the above code, it seems It will declare many many frmSearch object, right
?? Will it waste resources ???

I think I can decalre 1st) line once , and put 2nd) line in form_load() ,
right ??
Anydifference ??

Thanks for your kind reply.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top