By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,771 Members | 1,709 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,771 IT Pros & Developers. It's quick & easy.

Stupid Object declaratoin question

P: n/a
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.
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
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.

Nov 21 '05 #2

P: n/a
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
------------------
"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:%2***************@TK2MSFTNGP11.phx.gbl...
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.

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.