|
-
Sep 2nd, 2010, 07:54 PM
#1
Thread Starter
Addicted Member
Creating and Removing Controls
Hey everyone. I'm making quite the complex program, and while I try to figure out some more advanced methods that work better for what I'm trying to do, I'd like to learn how to do this (which is a bit of a roundabout method to what I've been trying). I'm wondering, how can I programatically create and remove objects? For example, I have webbrowser1. I want to remove it and create another webbrowser that I will also name webbrowser1. (therefore, the instance of the original must be removed) How would I go about doing this?
-
Sep 2nd, 2010, 07:58 PM
#2
Thread Starter
Addicted Member
Re: Creating and Removing Controls
That, or if someone can tell me how to refresh the internet settings so that the webbrowser will update its IP address according to the registry. Thanks for the help.
-
Sep 2nd, 2010, 07:59 PM
#3
Re: Creating and Removing Controls
try this:
vb Code:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim webbrowser1 As New WebBrowser
webbrowser1.Name = "webbrowser1"
Me.Controls.Add(webbrowser1)
Me.Controls.Remove(webbrowser1)
'or
Me.Controls.RemoveByKey("webbrowser1")
'or
Me.Controls.OfType(Of WebBrowser).ToArray(0).Dispose()
End Sub
End Class
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Sep 2nd, 2010, 08:01 PM
#4
Re: Creating and Removing Controls
 Originally Posted by arcticfang
That, or if someone can tell me how to refresh the internet settings so that the webbrowser will update its IP address according to the registry. Thanks for the help. 
how do you mean update its IP address?
you want to navigate to a different site?
vb Code:
webbrowser1.navigate(url)
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Sep 2nd, 2010, 08:15 PM
#5
Thread Starter
Addicted Member
Re: Creating and Removing Controls
Thanks for the code!!
I played around with it, and it works perfectly! Thanks so much for your help!!
-
Sep 2nd, 2010, 08:24 PM
#6
Thread Starter
Addicted Member
Re: Creating and Removing Controls
However, it's not working like I wanted it to. I'll post another thread with the original method I was trying to get help with that. I'll probably use this code later, however. Thanks for your help!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|