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

Refresh Listbox1 items

P: n/a
I have a Listbox1 in the main form and I can add listbox1 items in the
parent form. But when I close the parent form Listbox1 in the main form does
not get refresh. I need to re-open the app.

Any idea on how to refresh items in the main from from a parent form without
opening the app.

-Thanks

Sep 7 '08 #1
Share this Question
Share on Google+
5 Replies


P: n/a
On Sep 7, 5:30 am, "BlackBox" <replymeo...@hotmail.comwrote:
I have a Listbox1 in the main form and I can add listbox1 items in the
parent form. But when I close the parent form Listbox1 in the main form does
not get refresh. I need to re-open the app.

Any idea on how to refresh items in the main from from a parent form without
opening the app.

-Thanks
Use "<form>.Refresh" for other forms and "Me.Refresh" for current
form.

Or depending on your wish, you can try Listbox1.Refresh method.

Onur Güzel
Sep 7 '08 #2

P: n/a
Well I forgot to mention the listbox1 should get refreshed after I close the
parent window.

"kimiraikkonen" <ki*************@gmail.comwrote in message
news:03**********************************@m73g2000 hsh.googlegroups.com...
On Sep 7, 5:30 am, "BlackBox" <replymeo...@hotmail.comwrote:
>I have a Listbox1 in the main form and I can add listbox1 items in the
parent form. But when I close the parent form Listbox1 in the main form
does
not get refresh. I need to re-open the app.

Any idea on how to refresh items in the main from from a parent form
without
opening the app.

-Thanks

Use "<form>.Refresh" for other forms and "Me.Refresh" for current
form.

Or depending on your wish, you can try Listbox1.Refresh method.

Onur Güzel
Sep 7 '08 #3

P: n/a
On Sep 7, 1:47 pm, "BlackBox" <replymeo...@hotmail.comwrote:
Well I forgot to mention the listbox1 should get refreshed after I close the
parent window.

"kimiraikkonen" <kimiraikkone...@gmail.comwrote in message

news:03**********************************@m73g2000 hsh.googlegroups.com...
On Sep 7, 5:30 am, "BlackBox" <replymeo...@hotmail.comwrote:
I have a Listbox1 in the main form and I can add listbox1 items in the
parent form. But when I close the parent form Listbox1 in the main form
does
not get refresh. I need to re-open the app.
Any idea on how to refresh items in the main from from a parent form
without
opening the app.
-Thanks
Use "<form>.Refresh" for other forms and "Me.Refresh" for current
form.
Or depending on your wish, you can try Listbox1.Refresh method.
Onur Güzel
Then, IIUC, you need to handle FormClosed event which is raised after
form is closed. But, curious, why do you mean by "refreshing"? Adding
new items or using Refresh method which redraws the control? Because
as you re-open your form, it may be needless to call Refresh method
based on your implementation.

Thanks,

Onur Güzel
Sep 7 '08 #4

P: n/a
Well here is the explanation -
I have a listbox1 in main form containing product lists. Now I allow the
user to add new products in the second form and when they close the second
form - the main form should update the new product items in the Listbox1
under main form. And I don't know what is the best way to do it.

Thanks

"kimiraikkonen" <ki*************@gmail.comwrote in message
news:96**********************************@j22g2000 hsf.googlegroups.com...
On Sep 7, 1:47 pm, "BlackBox" <replymeo...@hotmail.comwrote:
Well I forgot to mention the listbox1 should get refreshed after I close
the
parent window.

"kimiraikkonen" <kimiraikkone...@gmail.comwrote in message

news:03**********************************@m73g2000 hsh.googlegroups.com...
On Sep 7, 5:30 am, "BlackBox" <replymeo...@hotmail.comwrote:
I have a Listbox1 in the main form and I can add listbox1 items in the
parent form. But when I close the parent form Listbox1 in the main form
does
not get refresh. I need to re-open the app.
Any idea on how to refresh items in the main from from a parent form
without
opening the app.
-Thanks
Use "<form>.Refresh" for other forms and "Me.Refresh" for current
form.
Or depending on your wish, you can try Listbox1.Refresh method.
Onur Güzel
Then, IIUC, you need to handle FormClosed event which is raised after
form is closed. But, curious, why do you mean by "refreshing"? Adding
new items or using Refresh method which redraws the control? Because
as you re-open your form, it may be needless to call Refresh method
based on your implementation.

Thanks,

Onur Güzel
Sep 8 '08 #5

P: n/a
On Sep 8, 3:44 am, "IndiDeveloper" <replymeo...@hotmail.comwrote:
Well here is the explanation -
I have a listbox1 in main form containing product lists. Now I allow the
user to add new products in the second form and when they close the second
form - the main form should update the new product items in the Listbox1
under main form. And I don't know what is the best way to do it.

Thanks

"kimiraikkonen" <kimiraikkone...@gmail.comwrote in message

news:96**********************************@j22g2000 hsf.googlegroups.com...
On Sep 7, 1:47 pm, "BlackBox" <replymeo...@hotmail.comwrote:
Well I forgot to mention the listbox1 should get refreshed after I close
the
parent window.
"kimiraikkonen" <kimiraikkone...@gmail.comwrote in message
news:03**********************************@m73g2000 hsh.googlegroups.com....
On Sep 7, 5:30 am, "BlackBox" <replymeo...@hotmail.comwrote:
>I have a Listbox1 in the main form and I can add listbox1 items in the
>parent form. But when I close the parent form Listbox1 in the main form
>does
>not get refresh. I need to re-open the app.
>Any idea on how to refresh items in the main from from a parent form
>without
>opening the app.
>-Thanks
Use "<form>.Refresh" for other forms and "Me.Refresh" for current
form.
Or depending on your wish, you can try Listbox1.Refresh method.
Onur Güzel

Then, IIUC, you need to handle FormClosed event which is raised after
form is closed. But, curious, why do you mean by "refreshing"? Adding
new items or using Refresh method which redraws the control? Because
as you re-open your form, it may be needless to call Refresh method
based on your implementation.

Thanks,

Onur Güzel
Well, then you need to add new items of second form's listbox
items(items which will be added to the entire product list) into main
form's listbox. So, you'd better handle FormClosing event of second
form and add all the items to the main form's listbox before second
form is closed, as follows:

'----Begin------
'Add second form's listbox items into entire list
'which are located in mainform's listbox.
'Put the code in your second form
Private Sub SecondForm_FormClosing(ByVal sender As System.Object, _
ByVal e As System.Windows.Forms.FormClosingEventArgs) _
Handles MyBase.FormClosing

MainForm.mainforms_listbox.Items.AddRange(Me.secon dforms_listbox.Items)

End Sub
'----End------

...where "MainForm" is the name of your main form, "mainforms_listbox"
is the name of your main form's listbox, "second_form" is the name of
your second form and "secondforms_listbox" is the name of your second
form's listbox.
Hope this helps,

Onur Güzel

Sep 8 '08 #6

This discussion thread is closed

Replies have been disabled for this discussion.