473,385 Members | 1,736 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Controls added at runtime??

Dear friends

I have to forms, frm1 and frm2. In frm1 its Button1 and TextBox1. In runtime
when clicking on Button1 a button is created on frm2 like this:

Dim myfrm2 as New frm2
Dim bt As New Button
AddHandler bt.Click, AddressOf myButton_Click
myfrm2.Controls.Add(bt)

In Module1 the myButton_Click event is like this:

Public Sub myButton_Click(ByVal sender As System.Object, ByVal e As
System.EventsArgs)

'Doe something'

End Sub

My goal is to print "Hello" in TextBox1 in frm1 when fiering the
myButton_Click event, but I cant figure out how.
Regards Able
Nov 20 '05 #1
4 890
"Able" <ab**@epost.no> schrieb
Dear friends

I have to forms, frm1 and frm2. In frm1 its Button1 and TextBox1. In
runtime when clicking on Button1 a button is created on frm2 like
this:

Dim myfrm2 as New frm2
Dim bt As New Button
AddHandler bt.Click, AddressOf myButton_Click
myfrm2.Controls.Add(bt)

In Module1 the myButton_Click event is like this:

Public Sub myButton_Click(ByVal sender As System.Object, ByVal e
As System.EventsArgs)

'Doe something'

End Sub

My goal is to print "Hello" in TextBox1 in frm1 when fiering the
myButton_Click event, but I cant figure out how.

IMO this is bad design. Why use a module? Why not handle the event within
frm1? In frm1 you would have access to the textbox.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #2
Please give a rookey an example.

Able

"Armin Zingler" <az*******@freenet.de> skrev i melding
news:OF**************@TK2MSFTNGP10.phx.gbl...
"Able" <ab**@epost.no> schrieb
Dear friends

I have to forms, frm1 and frm2. In frm1 its Button1 and TextBox1. In
runtime when clicking on Button1 a button is created on frm2 like
this:

Dim myfrm2 as New frm2
Dim bt As New Button
AddHandler bt.Click, AddressOf myButton_Click
myfrm2.Controls.Add(bt)

In Module1 the myButton_Click event is like this:

Public Sub myButton_Click(ByVal sender As System.Object, ByVal e
As System.EventsArgs)

'Doe something'

End Sub

My goal is to print "Hello" in TextBox1 in frm1 when fiering the
myButton_Click event, but I cant figure out how.

IMO this is bad design. Why use a module? Why not handle the event within
frm1? In frm1 you would have access to the textbox.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #3
"Able" <ab**@epost.no> schrieb
Please give a rookey an example.


You already wrote the code. :-) Put the procedure in frm1, not in the
module.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #4
In my county we have a saying like this:

"You dont see the wood because of all the trees."

Thanks Armin

Able

"Armin Zingler" <az*******@freenet.de> skrev i melding
news:e$**************@TK2MSFTNGP09.phx.gbl...
"Able" <ab**@epost.no> schrieb
Please give a rookey an example.


You already wrote the code. :-) Put the procedure in frm1, not in the
module.
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eric | last post by:
I am in need of some advice on how to do the following: Have some type of container on form that would fill the visible area on screen (assuming the browser was maximized). I would like to...
4
by: Chuck Ritzke | last post by:
Hi, I've searched the newsgroup and other sources to understand how to handle runtime controls and see I'm not the only one who's confused, but I'm still not quite sure of the best way to handle...
1
by: Jeff Smith | last post by:
Can I load custom web user controls dynamically and access the properties and methods without having to explicitly define custom control types (example 2 below). I have custom web control named...
1
by: Guadala Harry | last post by:
I will be creating a new ASPX that requires many controls to be inserted into the page at runtime. The controls include things like TextBox, RadioButtonList, CheckBoxList, DropDownList, etc....
0
by: Jeremy Chapman | last post by:
I have included below virtually all the code to a control I'm trying to build. My issue is that an array list property in my control does not get persisted properly to the aspx page code in design...
0
by: anandv81 | last post by:
Hi, I encountered a strange problem while working on an application, the problem goes like this. I am generating a few textboxes at runtime at the server side and added to a placeholder, a...
15
by: rizwanahmed24 | last post by:
Hello i have made a custom control. i have placed a panel on it. I want this panel to behave just like the normal panel. The problem i was having is that the panel on my custom control doesnt...
2
by: Rob | last post by:
I am not sure if this can be implemented.... There exists a TabContol (added at design time) to a form.. Tabs for this TabContol get added at run time. Usage of the following 2 properties...
2
by: =?Utf-8?B?VG9u?= | last post by:
Hello, I want to understand teh benefits of ajax technology. Does anyone has a good website where AJAX EXTENSIONS is worked out so I really understand it. There a 2 main questions: 1) How about...
5
by: gerry | last post by:
I am trying to create a custom container control that will only ever contain a specific type of control. At design time, when a control of a different type is added to the container I would like...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
0
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...
0
Oralloy
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.