473,722 Members | 2,484 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to Dispose a User Control and Remove Handlers

I have a form on which user controls are placed at runtime. When a control
is added to the form a handler is added for an event that a high-level
object raises, which must be handled by the new control. When I close the
form I am expecting that the control ceases to be.

However, if my object raises the event after the form has been closed, I
find that there is still a user control object that handles it. Clearly the
user control has not ceased to be after all.

What is the technique for destroying the user control so that it is no
longer around to handle my object's events?

I have tried calling Dispose on the user control but this does not help. I
do not want to have to remove the event handler manually (in code) unless
there is an easy way to remove all handlers in one fell swoop. In reality, I
have many different controls, any or all of which could be added to the form
at runtime, and which can individually handle a large number of events.
Coding to remove all the events manually would be a maintenance nightmare.

TIA

Charles
Nov 20 '05 #1
9 20175
Hi Charles,

I have learned a new English word.

Although your problems are always very deep, I was thinking that maybe this
could help for you.
(Take a look twice, it is not that simple as in first look). The usercontrol
I used is just a usercontrol with a textbox on it, nothing more.

It are dynamicly created usercontrols which acts in my idea completly in the
normal way. (I give you all the code to show you that it is a normal
situation, which uses the normal behaviour of a form). I did not test if it
does cease everything, that is yours to do, however I thought it meets a lot
of the needs you wrote.

I hope it helps?

Cor

\\\
Public Class Form1
Inherits System.Windows. Forms.Form
Public Sub New()
MyBase.New()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
Private components As System.Componen tModel.IContain er
Friend UserControlA(0) As WindowsApplicat ion1.UserContro l1
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Me.SuspendLayou t()
ReDim UserControlA(Us erControlA.Leng th)
Dim Cease As Integer = UserControlA.Le ngth - 1
CreateNextContr ol(Cease)
ReDim UserControlA(Us erControlA.Leng th)
Cease = UserControlA.Le ngth - 1
CreateNextContr ol(Cease)
Me.ClientSize = New System.Drawing. Size(500, 500)
Me.ResumeLayout (False)
End Sub
Private Sub CreateNextContr ol(ByVal Cease As Integer)
Me.UserControlA (Cease) = New WindowsApplicat ion10.UserContr ol1
Me.UserControlA (Cease).Locatio n = New System.Drawing. Point _
((Cease - 1) * 250 + 1, 1)
Me.UserControlA (Cease).Size = New System.Drawing. Size(250, 250)
Me.UserControlA (Cease).TabInde x = Cease
AddHandler UserControlA(Ce ase).TextBox1.C lick, _
AddressOf UserControlA_Cl ick
Me.Controls.Add (Me.UserControl A(Cease))
End Sub
Private Sub UserControlA_Cl ick(ByVal sender As _
System.Object, ByVal e As System.EventArg s)
For Each ctr As Control In Me.Controls
If TypeOf ctr Is UserControl1 Then
DirectCast(ctr, UserControl1).T extBox1.Text = ""
End If
Next
DirectCast(send er, TextBox).Text = "I am here"
End Sub
End Class
///
Nov 20 '05 #2
Hi Cor

Please excuse me being a bit slow on the uptake, but although I can run the
code you posted, I am not sure how it helps me. I have looked twice, as
instructed, but I don't see how it relates to the problem I have of a user
control living on after the form on which it resides is closed.

Am I missing something blindingly obvious?

Charles
[What is the new English word?]
"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:u0******** ******@TK2MSFTN GP09.phx.gbl...
Hi Charles,

I have learned a new English word.

Although your problems are always very deep, I was thinking that maybe this could help for you.
(Take a look twice, it is not that simple as in first look). The usercontrol I used is just a usercontrol with a textbox on it, nothing more.

It are dynamicly created usercontrols which acts in my idea completly in the normal way. (I give you all the code to show you that it is a normal
situation, which uses the normal behaviour of a form). I did not test if it does cease everything, that is yours to do, however I thought it meets a lot of the needs you wrote.

I hope it helps?

Cor

\\\
Public Class Form1
Inherits System.Windows. Forms.Form
Public Sub New()
MyBase.New()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
Private components As System.Componen tModel.IContain er
Friend UserControlA(0) As WindowsApplicat ion1.UserContro l1
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Me.SuspendLayou t()
ReDim UserControlA(Us erControlA.Leng th)
Dim Cease As Integer = UserControlA.Le ngth - 1
CreateNextContr ol(Cease)
ReDim UserControlA(Us erControlA.Leng th)
Cease = UserControlA.Le ngth - 1
CreateNextContr ol(Cease)
Me.ClientSize = New System.Drawing. Size(500, 500)
Me.ResumeLayout (False)
End Sub
Private Sub CreateNextContr ol(ByVal Cease As Integer)
Me.UserControlA (Cease) = New WindowsApplicat ion10.UserContr ol1
Me.UserControlA (Cease).Locatio n = New System.Drawing. Point _
((Cease - 1) * 250 + 1, 1)
Me.UserControlA (Cease).Size = New System.Drawing. Size(250, 250)
Me.UserControlA (Cease).TabInde x = Cease
AddHandler UserControlA(Ce ase).TextBox1.C lick, _
AddressOf UserControlA_Cl ick
Me.Controls.Add (Me.UserControl A(Cease))
End Sub
Private Sub UserControlA_Cl ick(ByVal sender As _
System.Object, ByVal e As System.EventArg s)
For Each ctr As Control In Me.Controls
If TypeOf ctr Is UserControl1 Then
DirectCast(ctr, UserControl1).T extBox1.Text = ""
End If
Next
DirectCast(send er, TextBox).Text = "I am here"
End Sub
End Class
///

Nov 20 '05 #3
Hi Charles,

Because I created in the form that usercontrol completly as a normal control
and that it is used as a normal control (except that it is created
dynamicly, however not in the procedure but outside as a normal control) , I
would expect that it would dispose as a normal control. Did you make that
textbox usercontrol with it?

(the word is cease)

I will search further however I do not know why the usercontrol should in
this sitiation live on.

Cor

"
Nov 20 '05 #4
Hi Cor

Yes, I created the UserControl1 with a textbox on it.

I wonder if the user control survives because the object that has the
handler attached is outside the form. In that respect, the object still
holds a reference to the user control, albeit just one of its methods as
sink for the event. That is why I tried explicitly disposing the control,
but to no avail.

I really need a way to totally destroy the control, and for it to happen
immediately, but that does not seem to be the way of .NET.

Charles
"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:OG******** ******@TK2MSFTN GP09.phx.gbl...
Hi Charles,

Because I created in the form that usercontrol completly as a normal control and that it is used as a normal control (except that it is created
dynamicly, however not in the procedure but outside as a normal control) , I would expect that it would dispose as a normal control. Did you make that
textbox usercontrol with it?

(the word is cease)

I will search further however I do not know why the usercontrol should in
this sitiation live on.

Cor

"

Nov 20 '05 #5
Hi Charles,

Is this something you want, (I use that click event with a "d" in the
textbox to remove the usercontrol have a look for that, just dirthy) (The
control is in the code now, you can paste it in a empty form/vb and it
should run).

Cor

Public Class Form1
Inherits System.Windows. Forms.Form
Public Sub New()
MyBase.New()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
Private components As System.Componen tModel.IContain er
Friend UserControlA(0) As WindowsApplicat ion10.UserContr ol1
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Me.SuspendLayou t()
ReDim UserControlA(Us erControlA.Leng th)
Dim Cease As Integer = UserControlA.Le ngth - 1
CreateNextContr ol(Cease)
ReDim UserControlA(Us erControlA.Leng th)
Cease = UserControlA.Le ngth - 1
CreateNextContr ol(Cease)
Me.ClientSize = New System.Drawing. Size(500, 500)
Me.ResumeLayout (False)
End Sub
Private Sub CreateNextContr ol(ByVal Cease As Integer)
Me.UserControlA (Cease) = New WindowsApplicat ion10.UserContr ol1
Me.UserControlA (Cease).Locatio n = New System.Drawing. Point _
((Cease - 1) * 250 + 1, 1)
Me.UserControlA (Cease).Size = New System.Drawing. Size(250, 250)
Me.UserControlA (Cease).TabInde x = Cease
AddHandler UserControlA(Ce ase).Click, _
AddressOf UserControlA_Cl ick
Me.Controls.Add (Me.UserControl A(Cease))
End Sub
Private Sub UserControlA_Cl ick(ByVal sender As _
System.Object, ByVal e As System.EventArg s)
If DirectCast(send er, TextBox).Text <> "" Then
If DirectCast(send er, TextBox).Text.S ubstring(0, 1).ToLower =
"d" Then
Me.Controls.Rem ove(DirectCast( sender, Control).Parent )
DirectCast(send er, Control).Parent .Dispose()
End If
End If
For Each ctr As Control In Me.Controls
If TypeOf ctr Is UserControl1 Then
DirectCast(ctr, UserControl1).T extBox1.Text = ""
End If
Next
DirectCast(send er, TextBox).Text = "I am here"
End Sub
End Class
Public Class UserControl1
Inherits System.Windows. Forms.UserContr ol
Public Shadows Event Click(ByVal sender As Object, _
ByVal e As System.EventArg s)
Public Sub New()
MyBase.New()
InitializeCompo nent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
Private components As System.Componen tModel.IContain er
Friend WithEvents TextBox1 As System.Windows. Forms.TextBox
Private Sub InitializeCompo nent()
Me.TextBox1 = New System.Windows. Forms.TextBox
Me.SuspendLayou t()
Me.TextBox1.Loc ation = New System.Drawing. Point(0, 0)
Me.TextBox1.Mul tiline = True
Me.TextBox1.Siz e = New System.Drawing. Size(100, 100)
Me.TextBox1.Tab Index = 0
Me.TextBox1.Tex t = ""
Me.Controls.Add (Me.TextBox1)
Me.Name = "UserContro l1"
Me.Size = New System.Drawing. Size(101, 101)
Me.ResumeLayout (False)
End Sub
Private Sub TextBox1_Click( ByVal sender As Object, _
ByVal e As System.EventArg s) Handles TextBox1.Click
RaiseEvent Click(sender, e)
End Sub
End Class
Nov 20 '05 #6
Hi Cor

I have modified the code to illustrate the problem. You can likewise paste
it into a forms app and run it. Mine happens to be called
WindowsApplicat ion7.

<code>
Option Explicit On
Option Strict On

Public Class Form1

Inherits System.Windows. Forms.Form

Private components As System.Componen tModel.IContain er
Friend WithEvents Button1 As System.Windows. Forms.Button
Friend WithEvents Button2 As System.Windows. Forms.Button
Friend UserControlA As WindowsApplicat ion7.UserContro l1

Public Sub New()
MyBase.New()

InitializeCompo nent()

End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
Private Sub InitializeCompo nent()
Me.Button1 = New System.Windows. Forms.Button
Me.Button2 = New System.Windows. Forms.Button
Me.UserControlA = New WindowsApplicat ion7.UserContro l1
Me.SuspendLayou t()
'
'Button1
'
Me.Button1.Loca tion = New System.Drawing. Point(240, 16)
Me.Button1.Name = "Button1"
Me.Button1.TabI ndex = 0
Me.Button1.Text = "Remove"
'
'Button2
'
Me.Button2.Loca tion = New System.Drawing. Point(240, 56)
Me.Button2.Name = "Button2"
Me.Button2.TabI ndex = 1
Me.Button2.Text = "Raise Event"
'
' UserControlA
Me.UserControlA .Location = New Point(1, 1)
Me.UserControlA .Size = New System.Drawing. Size(250, 250)
Me.Name = "UserContro lA"
'
'Form1
'
Me.AutoScaleBas eSize = New System.Drawing. Size(5, 13)
Me.ClientSize = New System.Drawing. Size(320, 237)
Me.Controls.Add (Me.Button2)
Me.Controls.Add (Me.Button1)
Me.Controls.Add (Me.UserControl A)
Me.Name = "Form1"
Me.ResumeLayout (False)

End Sub

Public Event MyEvent(ByVal sender As Object, ByVal e As EventArgs)

Private Sub Form1_Load(ByVa l sender As Object, ByVal e As
System.EventArg s) Handles MyBase.Load

Me.ClientSize = New System.Drawing. Size(500, 500)

AddHandler MyEvent, AddressOf UserControlA.Us erControl_Event Handler

End Sub

Private Sub OnEvent()

RaiseEvent MyEvent(Me, New EventArgs)

End Sub

Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button1.Click

Controls.Remove (UserControlA)

UserControlA.Di spose()

End Sub

Private Sub Button2_Click(B yVal sender As System.Object, ByVal e As
System.EventArg s) Handles Button2.Click

OnEvent()

End Sub

End Class

Public Class UserControl1

Inherits System.Windows. Forms.UserContr ol

Public Sub New()
MyBase.New()
InitializeCompo nent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub

Private components As System.Componen tModel.IContain er
Friend WithEvents TextBox1 As System.Windows. Forms.TextBox

Private Sub InitializeCompo nent()
Me.TextBox1 = New System.Windows. Forms.TextBox
Me.SuspendLayou t()
Me.TextBox1.Loc ation = New System.Drawing. Point(0, 0)
Me.TextBox1.Mul tiline = True
Me.TextBox1.Siz e = New System.Drawing. Size(100, 100)
Me.TextBox1.Tab Index = 0
Me.TextBox1.Tex t = ""
Me.Controls.Add (Me.TextBox1)
Me.Name = "UserContro l1"
Me.Size = New System.Drawing. Size(101, 101)
Me.ResumeLayout (False)
End Sub

Public Sub UserControl_Eve ntHandler(ByVal sender As Object, ByVal e As
EventArgs)

MessageBox.Show ("I am here")

End Sub

End Class
</code>

When the form is created two buttons and a user control are created. When
the form loads an even handler is added for the event MyEvent in Form1. The
handler is in the user control.

Click the button "Raise Event" and you will see a message box. Each time it
is clicked that is what happens.

Now, click the "Remove" button and the user control will disappear. It also
gets disposed.

Click the "Raise Event" button again, and the message box still appears,
even though the user control has gone. What I am trying to achieve is that
when the user control is destroyed, it no longer lives on to service events.

Thanks.

Charles
"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:eh******** ******@tk2msftn gp13.phx.gbl...
Hi Charles,

Is this something you want, (I use that click event with a "d" in the
textbox to remove the usercontrol have a look for that, just dirthy) (The
control is in the code now, you can paste it in a empty form/vb and it
should run).

Cor

Public Class Form1
Inherits System.Windows. Forms.Form
Public Sub New()
MyBase.New()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
Private components As System.Componen tModel.IContain er
Friend UserControlA(0) As WindowsApplicat ion10.UserContr ol1
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Me.SuspendLayou t()
ReDim UserControlA(Us erControlA.Leng th)
Dim Cease As Integer = UserControlA.Le ngth - 1
CreateNextContr ol(Cease)
ReDim UserControlA(Us erControlA.Leng th)
Cease = UserControlA.Le ngth - 1
CreateNextContr ol(Cease)
Me.ClientSize = New System.Drawing. Size(500, 500)
Me.ResumeLayout (False)
End Sub
Private Sub CreateNextContr ol(ByVal Cease As Integer)
Me.UserControlA (Cease) = New WindowsApplicat ion10.UserContr ol1
Me.UserControlA (Cease).Locatio n = New System.Drawing. Point _
((Cease - 1) * 250 + 1, 1)
Me.UserControlA (Cease).Size = New System.Drawing. Size(250, 250)
Me.UserControlA (Cease).TabInde x = Cease
AddHandler UserControlA(Ce ase).Click, _
AddressOf UserControlA_Cl ick
Me.Controls.Add (Me.UserControl A(Cease))
End Sub
Private Sub UserControlA_Cl ick(ByVal sender As _
System.Object, ByVal e As System.EventArg s)
If DirectCast(send er, TextBox).Text <> "" Then
If DirectCast(send er, TextBox).Text.S ubstring(0, 1).ToLower =
"d" Then
Me.Controls.Rem ove(DirectCast( sender, Control).Parent )
DirectCast(send er, Control).Parent .Dispose()
End If
End If
For Each ctr As Control In Me.Controls
If TypeOf ctr Is UserControl1 Then
DirectCast(ctr, UserControl1).T extBox1.Text = ""
End If
Next
DirectCast(send er, TextBox).Text = "I am here"
End Sub
End Class
Public Class UserControl1
Inherits System.Windows. Forms.UserContr ol
Public Shadows Event Click(ByVal sender As Object, _
ByVal e As System.EventArg s)
Public Sub New()
MyBase.New()
InitializeCompo nent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Disp ose()
End If
End If
MyBase.Dispose( disposing)
End Sub
Private components As System.Componen tModel.IContain er
Friend WithEvents TextBox1 As System.Windows. Forms.TextBox
Private Sub InitializeCompo nent()
Me.TextBox1 = New System.Windows. Forms.TextBox
Me.SuspendLayou t()
Me.TextBox1.Loc ation = New System.Drawing. Point(0, 0)
Me.TextBox1.Mul tiline = True
Me.TextBox1.Siz e = New System.Drawing. Size(100, 100)
Me.TextBox1.Tab Index = 0
Me.TextBox1.Tex t = ""
Me.Controls.Add (Me.TextBox1)
Me.Name = "UserContro l1"
Me.Size = New System.Drawing. Size(101, 101)
Me.ResumeLayout (False)
End Sub
Private Sub TextBox1_Click( ByVal sender As Object, _
ByVal e As System.EventArg s) Handles TextBox1.Click
RaiseEvent Click(sender, e)
End Sub
End Class

Nov 20 '05 #7
Hi Charles,

I find this very clear, in class Form1 you have set a reference for an
adress in Usercontrol1.
For me that address is clearly from Form1, there is no reason why
UserControl1 should no about that address.

That reference is not cleared before you try to delete the Usercontrol1, so
while trying to dispose the reference is still there, very nice that it
stays, what can happen when it was deleted. Normaly just an error.

However why should disposing remove a reference in class Form1, because that
is your problem in my opinon.

When you add a removeHandler MyEvent works fine, there is even no need to
dispose the usercontrol.

However what am I seeing wrong?

Cor
Nov 20 '05 #8
> I find this very clear, in class Form1 you have set a reference for an
adress in Usercontrol1.
For me that address is clearly from Form1, there is no reason why
UserControl1 should no about that address.


know
Nov 20 '05 #9
Hi Cor

I see what you mean, but I was hoping that the handlers would be removed
automatically when I dispose the control. What I want to avoid is having to
write code that removes all the handlers manually.

In practice, I have many controls, and they all sink different events. When
I destroy a given user control, it could be one of many different controls,
and I would need a big Select Case block to pick the right type of control,
and then a whole stream of RemoveHandler statements to remove the handlers.
Furthermore, I don't necessarily know to which object the user control is
attached, so that would make it even harder to remove the handlers.

For example, at runtime I might have

AddHandler obj1.SomeEvent, AddressOf usercontrolA.So meEventHandler
AddHandler obj1.SomeOtherE vent, AddressOf usercontrolB.So meOtherEventHan dler
AddHandler obj2.YetAnother Event, AddressOf
usercontrolA.Ye tAnotherEventHa ndler

So, an object can have event handlers in many user controls, and a user
control can handle events from many objects.

When I come to destroy usercontrolA, for example, I will have to remove the
handlers, but I won't know which object(s) it is handling events for. Do you
see my dilemma?

Any ideas?

Charles
"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:OC******** ******@TK2MSFTN GP10.phx.gbl...
Hi Charles,

I find this very clear, in class Form1 you have set a reference for an
adress in Usercontrol1.
For me that address is clearly from Form1, there is no reason why
UserControl1 should no about that address.

That reference is not cleared before you try to delete the Usercontrol1, so while trying to dispose the reference is still there, very nice that it
stays, what can happen when it was deleted. Normaly just an error.

However why should disposing remove a reference in class Form1, because that is your problem in my opinon.

When you add a removeHandler MyEvent works fine, there is even no need to
dispose the usercontrol.

However what am I seeing wrong?

Cor

Nov 20 '05 #10

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

Similar topics

0
1067
by: pagates | last post by:
Hi All, Is there any way to get the list of events that a particular control handles, so they can be added or removed dynamically? In other words, say I have a TreeView that handles the AfterLabelEdit, BeforeLabelEdit, and ItemDrag events (just to use some events as an example). If I remove this tree control programatically, and then add it back in with a different parent, I've lost the event handlers. I'd like to recreate these
5
9748
by: George Durzi | last post by:
I have a simple user control with a text box and a submit button. When the user enters some text into the textbox and clicks the submit button, a record is created in the database. I'm using this user control inside another webform. The webform has a "Next" button which is initially disabled. When the user control successfully adds a record I want the Next button on the webform to get enabled. Checking if the record was added...
156
5869
by: Dennis | last post by:
Ok, I'm trying to dispose of every object that I create that has a dispose method based on advice from this newsgroup. However, I'm not sure how to dispose of the following object that was created inside a method call. dim myvar as new object1 object1.dosomethingmethod(new object2) Note that object 2 has a dispose method but how do I dispose of it unless I do the following:
0
936
by: CBeers | last post by:
I currently have a project in production running under ASP.NET 1.1. The project contains a page that loads a User Control dynamically in the Page_Load event and then adds the User Control to a placeholder controls collection. The User Control contains several hyperlink buttons with corresponding event handlers that perform particular functions within the control. In some cases the control is specifically removed from the placeholder...
0
3203
by: Jeff | last post by:
Banging my head against the wall trying to figure this out. I have a 'sometimes' hang while disposing a form which contains an ActiveX control (Flash.ocx version 7). The form's Dispose() method generated by the form designer protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null)
1
3140
by: Flack | last post by:
Hey guys, I'm having some weird issues when calling Dispose on one of the controls in a user control from an asycn or sync method. When called form an async method Dispose makes a call to SelectNextControl but not when called from a sync method. I'm trying to figure out why that is so. Does anyone know under what conditions Dispose will call SelectNextControl? I have a breakpoint set on the user controls OnValidated method and when...
5
3088
by: Lloyd Sheen | last post by:
Is there a way to get the event handlers such that I can cache the info about handlers for a particular control, remove the handlers, do some code and restore the cached event handlers in VB.NET (2008). I would rather do things this way than having to have a boolean flag to indicated to the handler to exit right away. Psuedo code: CacheHandlers(control)
7
2857
by: Aussie Rules | last post by:
Hi, Is there a way to have a screen/form designer functionality in a vb.net2008 program for the end user to use ? I want to be able to distribute my application, and allow the end user to make change to my forms to suit there needs, or perhaps even create there own to display certian information. Thanks
3
4370
balabaster
by: balabaster | last post by:
I've got a user control that builds a table of dynamic data based on a :LINQ class holding the data. The data is loaded using the LoadData(DataInstance) method. The table it builds contains a number of dynamic controls that themselves have postback/autopostback so the display of the control needs to be built at latest in the Page.Load event or the event handlers for the controls don't get wired up. Now if I have a page that uses this user...
0
9384
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, 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...
1
9157
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6681
isladogs
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...
0
5995
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4502
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...
0
4762
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3207
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
2
2602
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2147
bsmnconsultancy
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...

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.