Hello,
I am creating my own webbrowser to learn VB .Net. I am stuck on an issue
with regards to dynamically-created controls, in this case tabs on a
tabcontrol and webbrowsers created within each new tab.
Using AddHandler in a class, I can get the delegate Sub to display the name
of the webbrowser that has been clicked (by using msgbox(sender.t ag), where
I set the .tag value when creating the control).
What I need to be able to do is use Back, Forward, Stop, Print buttons etc
on ANY webbrowser currently with focus.
In a nutshell at runtime the user might have 6 tabs in a tabcontrol contain
a webbrowser each. How do I pass the value of the currently-selected
webbrowser, dynamically created, to these buttons from the class where I
created the tabs/webbrowsers?
I guess to do something like (quazi code)
webbrowser(x).g oback
is what I seek....any ideas? Completely stumped
O. 7 2552
O
Having the same problem myself - if anyone answers this, it will be a
miracle?
Gray
"msdev" <ms*******@nosp am.nospam> wrote in message
news:ON******** ******@TK2MSFTN GP12.phx.gbl... Hello,
I am creating my own webbrowser to learn VB .Net. I am stuck on an issue with regards to dynamically-created controls, in this case tabs on a tabcontrol and webbrowsers created within each new tab.
Using AddHandler in a class, I can get the delegate Sub to display the name of the webbrowser that has been clicked (by using msgbox(sender.t ag), where I set the .tag value when creating the control). What I need to be able to do is use Back, Forward, Stop, Print buttons etc on ANY webbrowser currently with focus.
In a nutshell at runtime the user might have 6 tabs in a tabcontrol contain a webbrowser each. How do I pass the value of the currently-selected webbrowser, dynamically created, to these buttons from the class where I created the tabs/webbrowsers?
I guess to do something like (quazi code)
webbrowser(x).g oback
is what I seek....any ideas? Completely stumped
O.
Have you tried getting the selected tab page from the tab control?
jvb
yep started there first of all. Problem is, it gives me the tabcontrol tab
that has been selected, but not the webbrowser contained within that tab.
I have been playing with addhandler, as I am sure it had something to do
with it, but to no avail.
What I need to do is to send the value of the currently-selected browser to
some "central settings" point, so that one set of buttons can control any
number of dynamically-created webbrowsers. The stumbling block for me is
trying to send the "currently selected" webbrowser to the goback, goforward,
print, stop buttons, so they only apply to that webbrowser in focus. If the
user selects another tab/webbrowser, the buttons will switch to work with
that focussed browser and so on.
I am probably not explaining it too well! Sorry
Did this help?
"jvb" <go*****@gmail. com> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. . Have you tried getting the selected tab page from the tab control?
If you know tab page selected, can you make the assumption that the
browser on that page is active? So in your code, in the button's click
event, you could try...
CType(TabContro l1.SelectedTab. Controls.Item(T abControl1.Sele ctedTab.Control s.GetChildIndex (<Your
Dynamically Created Web Control>)), AxSHDocVw.AxWeb Browser).GoBack ()
AxSHDocVw.AxWeb Browser is the browser control i use, not sure if you
are using the same.
You can always track the references yourself. i.e. when you dynamically
create the tab, put in a hashtable the TabIdentifier as the key and a
reference to the webbrowser control contained on that tab. Then as you
change tabs you can set the object reference of web browser (the reference
that is wired to the events) to the one from the hashtable.
something like this (fake code)
dim myBrowserContro l as webbrowser
form_load
addhandler browser.next, someproc
init_tab
create new tab tab
myhash(tabindex ) = webrowsercontro l on this tab
sub TabChange
myBrowserContro l = myHash(tabIndex )
end
"msdev" <ms*******@nosp am.nospam> wrote in message
news:ON******** ******@TK2MSFTN GP12.phx.gbl... Hello,
I am creating my own webbrowser to learn VB .Net. I am stuck on an issue with regards to dynamically-created controls, in this case tabs on a tabcontrol and webbrowsers created within each new tab.
Using AddHandler in a class, I can get the delegate Sub to display the name of the webbrowser that has been clicked (by using msgbox(sender.t ag), where I set the .tag value when creating the control). What I need to be able to do is use Back, Forward, Stop, Print buttons etc on ANY webbrowser currently with focus.
In a nutshell at runtime the user might have 6 tabs in a tabcontrol contain a webbrowser each. How do I pass the value of the currently-selected webbrowser, dynamically created, to these buttons from the class where I created the tabs/webbrowsers?
I guess to do something like (quazi code)
webbrowser(x).g oback
is what I seek....any ideas? Completely stumped
O.
Jeff,
I think you might be on to something here. Is there any chance you can
expand on your code a bit? I am new to dynamic controls in vb.net 2005.
If I replace webbrowser1.gob ack with mybrowsercontro l.goback, will this
work too?
G
Jeff Jarrell wrote: You can always track the references yourself. i.e. when you dynamically create the tab, put in a hashtable the TabIdentifier as the key and a reference to the webbrowser control contained on that tab. Then as you change tabs you can set the object reference of web browser (the reference that is wired to the events) to the one from the hashtable.
something like this (fake code)
dim myBrowserContro l as webbrowser
form_load addhandler browser.next, someproc
init_tab create new tab tab myhash(tabindex ) = webrowsercontro l on this tab
sub TabChange myBrowserContro l = myHash(tabIndex ) end
"msdev" <ms*******@nosp am.nospam> wrote in message news:ON******** ******@TK2MSFTN GP12.phx.gbl... Hello,
I am creating my own webbrowser to learn VB .Net. I am stuck on an issue with regards to dynamically-created controls, in this case tabs on a tabcontrol and webbrowsers created within each new tab.
Using AddHandler in a class, I can get the delegate Sub to display the name of the webbrowser that has been clicked (by using msgbox(sender.t ag), where I set the .tag value when creating the control). What I need to be able to do is use Back, Forward, Stop, Print buttons etc on ANY webbrowser currently with focus.
In a nutshell at runtime the user might have 6 tabs in a tabcontrol contain a webbrowser each. How do I pass the value of the currently-selected webbrowser, dynamically created, to these buttons from the class where I created the tabs/webbrowsers?
I guess to do something like (quazi code)
webbrowser(x).g oback
is what I seek....any ideas? Completely stumped
O.
It is going to look a little like this. I'd be careful to pick a good key
for the dictionary. In this case I am using the count of tab pages as part
of the key but that won't work if you ultimately take tab pages out. You
might also want to look at the "InitializeComp onent" on similar components
created at design time and set those same properties on the creation of the
dynamic controls.
Dim _dctWebBrowserR eferences As New Hashtable
Friend WithEvents _webbrowser As WebBrowser
Private Sub newPage()
Dim myNewTabPage As New TabPage
myNewTabPage.Na me = "Page" & Me.TabControl1. TabCount + 1
myNewTabPage.Te xt = "Page" & Me.TabControl1. TabCount + 1
Dim myNewBrowser As New WebBrowser
myNewBrowser.Na me = "WebBrowser " & Me.TabControl1. TabCount + 1
myNewBrowser.Do ck = DockStyle.Fill
Dim key As String
key = myNewTabPage.Te xt
_dctWebBrowserR eferences(key) = myNewBrowser
myNewTabPage.Co ntrols.Add(myNe wBrowser)
Me.TabControl1. Controls.Add(my NewTabPage)
End Sub
Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click
newPage()
End Sub
Private Sub TabControl1_Tab IndexChanged(By Val sender As Object, ByVal e As
System.EventArg s) Handles TabControl1.Tab IndexChanged
Dim myTabPage As TabPage
myTabPage = TabControl1.Sel ectedTab
Dim key As String
key = myTabPage.Text
Me._webbrowser = CType(Me._dctWe bBrowserReferen ces(key), WebBrowser)
End Sub
"gray" <ke****@freeuk. com> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. . Jeff,
I think you might be on to something here. Is there any chance you can expand on your code a bit? I am new to dynamic controls in vb.net 2005.
If I replace webbrowser1.gob ack with mybrowsercontro l.goback, will this work too?
G
Jeff Jarrell wrote: You can always track the references yourself. i.e. when you dynamically create the tab, put in a hashtable the TabIdentifier as the key and a reference to the webbrowser control contained on that tab. Then as you change tabs you can set the object reference of web browser (the reference that is wired to the events) to the one from the hashtable.
something like this (fake code)
dim myBrowserContro l as webbrowser
form_load addhandler browser.next, someproc
init_tab create new tab tab myhash(tabindex ) = webrowsercontro l on this tab
sub TabChange myBrowserContro l = myHash(tabIndex ) end
"msdev" <ms*******@nosp am.nospam> wrote in message news:ON******** ******@TK2MSFTN GP12.phx.gbl... > Hello, > > I am creating my own webbrowser to learn VB .Net. I am stuck on an > issue > with regards to dynamically-created controls, in this case tabs on a > tabcontrol and webbrowsers created within each new tab. > > Using AddHandler in a class, I can get the delegate Sub to display the > name of the webbrowser that has been clicked (by using > msgbox(sender.t ag), > where I set the .tag value when creating the control). > What I need to be able to do is use Back, Forward, Stop, Print buttons > etc > on ANY webbrowser currently with focus. > > In a nutshell at runtime the user might have 6 tabs in a tabcontrol > contain a webbrowser each. How do I pass the value of the > currently-selected webbrowser, dynamically created, to these buttons > from > the class where I created the tabs/webbrowsers? > > I guess to do something like (quazi code) > > webbrowser(x).g oback > > is what I seek....any ideas? Completely stumped > > O. > > This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Will |
last post by:
Hi all.
I'm learning VB.Net and am developing a WinForms app.
I'm trying to make an app that I will use to scan in one or more than
on image. I want to use a tabbed interface to hold each image. Here's
the code I'm using for testing purposes. I've got the code in the
form's load event, but I think I'd have the same problems no matter
where the code existed. Right now, the form has an empty tab control,
everthing else is dynamic.
<code>
|
by: MikeY |
last post by:
Hi Everyone,
Does anyone know where I can get my hands on a sample with source code of a
simple dynamic button control in C# Windows form. I am looking for a sample
that uses a class library that sets the properties send/passed from the main
windows form. I'm having problems with the class library, the button control
collection and my referencing it ie this.Control.Add(aControl);.
Any and all help is appreciated. Thanks in advance.
|
by: Trevor Hartman |
last post by:
Hi,
I need to refer to my objects dynamically. I have a 7 table cells (sunCell,
monCell, tueCell....). I am looping through some data, checking its date
and adding it to the correct cell. I want to be able to do something like:
string day;
foreach ...
{
day = getShortDay(someDateTime);
|
by: Felipe Garcia |
last post by:
Does makes difference referencing controls inside EVERY page
<%@ Register TagPrefix="PC" Namespace="MyControls"
Assembly="Personal.MyControls" %>
or referencing controls ONCE inside web.config, making it work for every
page in the project ?
<pages>
<controls>
|
by: louise raisbeck |
last post by:
Hi there,
I am databinding a datagrid on the onload with the usual !IsPostBack
condition.
I have to create some dynamic checkboxes, because i dont know how many i
will need until the dataset comes back. take it as red that writing them into
the aspx is not an option.
So on the databind function of my grid I am doing the following:
| |
by: Suzanne |
last post by:
Hi all,
I'm reposting this message as I'm experiencing this problem more and
more frequently :
I really hope someone out there can help me as I've been tearing my
hair out on this one for a good while and I'm getting really
frustrated now!
My problem is this - my custom controls periodically disappear from my
|
by: YYZ |
last post by:
In my program, a user can open up many different "Loans" -- each one is
loaded into a dynamically created usercontrol (ucLoan) -- in order for
them to be able to switch between the ones they have open, I have added
a Window menu item -- just like in Word or any one of a thousand
different applications.
Each Loan has a unique GUID, and I could easily enumerate all of the
ucLoan controls on the main form and check their GUID property to...
|
by: J055 |
last post by:
Hi
I have a FormView, Panel and ObjectDataSource control. I'm trying to change
the Panel.Visible property to true based on a value in the ReturnValue
object in the ObjectDataSource.Selected event. I can't find the Panel
control from the inside the Selected event method even though the control is
available earlier in the page life cycle, e.g.
protected void odsAccount_Selected(object sender,
ObjectDataSourceStatusEventArgs e)
|
by: Tarscher |
last post by:
hi all,
I have this seemingly simple problem. I have lost a lot of time on it
though.
When a user selects a value from a dropdownlist (static control) a
dynamic control is generated. I have to create the dynamic controls
in the OnInit stage of the lifecycle. Since data from static controls
is not yet available in the OnInit stage I can't know what dynamic
control I have to create.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |