Hi, Everybody.
I need to reload the form of my application. The application has only one form vb.net 2005.
I need a button that will call the page_load event so I can restart and reload all my settings.

basically I need to call the Sub private Page_load event().
I just need to force the reloading of the form without having to close it and reopen it.

This is the code which I need to reload:

Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
For Each URLname As String In My.Settings.URLtoTrackCollection


For Each item As String In My.Settings.ListboxCollection

Any help will be greatly appreciated.
Thanks in advance.

Recommended Answers

All 8 Replies

Move all of the code in your _Load event to another method so you can call it again from any part of your code within the form.

or call the load event with Form1_Load(Me, New System.EventArgs)

or call the load event with Form1_Load(Me, New System.EventArgs)

No, dont ever do that. Thats a bad idea all the way around.

why is that? any side effects by doing this? never done but was kind of logic :o

There are no side effects per se if you're careful developing but it breaks a few rules of logic:
* You assume that method is only going to be called when the form loads.
* When you look at a call stack and see the form's load method it might be unclear why the event is fired since it is called from a procedure after the forms window handle is created.

It's just not a good idea. How hard is it to move the code to another routine so when you look at it the code is obvious? :)

Form1_Load(Me, New System.EventArgs). I tried this one. It works.. thanks

hi... mark it solve..


Only the person who created this thread can mark as Solved. BTW, this thread is two years old. Please do not resurrect years old thread, "me too"! Start a new thread if you have a new question.

Thread Locked.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.