473,396 Members | 2,140 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,396 software developers and data experts.

Releasing an Event

Hello,
I've got a table and I create a tablestyle for it. This table is the
datasource for a dataGrid. In this createTableStyle function one of the
columns is a button. I tie a button to it.
buttonColStyle = new DataGridButtonColumn(i);

and a click event.
buttonColStyle.CellButtonClicked += new
DataGridCellButtonClickEventHandler(HandleCellButt onClick);

In the HandleCellButtonClick function, it calls another form.

This all works fine.except.

My problem is that on my main form I have a button which will pull new data
from a database and rebuild the table and tablestyle for the table. So, when
the above code is executed again, it ties another CellButtonClicked event to
the button. So now when I click the button in the datagrid and the form
comes up, I have to close it twice to get rid of it.
I've tried dataGrid1.TableStyles.Clear(); to maybe release it but that doesn
't work. Can someone tell me how to clear the events tied to a tableStyle?
Thanks to all...
Nov 16 '05 #1
1 1074
Hi,

try using buttonColStyle.CellButtonClicked -= new
DataGridCellButtonClickEventHandler(HandleCellButt onClick) to unsubscribe
the event from the delegate.

Regards
Joyjit

"Randy" <te**@temp.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hello,
I've got a table and I create a tablestyle for it. This table is the
datasource for a dataGrid. In this createTableStyle function one of the
columns is a button. I tie a button to it.
buttonColStyle = new DataGridButtonColumn(i);

and a click event.
buttonColStyle.CellButtonClicked += new
DataGridCellButtonClickEventHandler(HandleCellButt onClick);

In the HandleCellButtonClick function, it calls another form.

This all works fine.except.

My problem is that on my main form I have a button which will pull new data from a database and rebuild the table and tablestyle for the table. So, when the above code is executed again, it ties another CellButtonClicked event to the button. So now when I click the button in the datagrid and the form
comes up, I have to close it twice to get rid of it.
I've tried dataGrid1.TableStyles.Clear(); to maybe release it but that doesn 't work. Can someone tell me how to clear the events tied to a tableStyle?
Thanks to all...

Nov 16 '05 #2

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

Similar topics

4
by: lebo | last post by:
Hi I'm trying to understand how Python handles memory usage and dynamic object loading and unloading. Problem to solve? Build a very low memory footprint (non-GUI) Python application for...
31
by: poisondart | last post by:
Hi, I'm not sure if this is the right group to post this. If not, then I would appreciate if somebody could point me to the correct group. This is my first time releasing software to the...
2
by: sausage31 | last post by:
I'm exporting some data to excel but am having trouble getting Access to 'release' Excel. What i want to achieve is to open excel, export some data then leave excel open so that the user can...
18
by: lylefair | last post by:
Can you post code, or a reference to a md? or ad? file on a website, where object variables are not released when they go out of scope and cause a problem, (but causing a problem is extraneous to...
8
by: One Handed Man [ OHM# ] | last post by:
Scenario. PDA connecting to a web service method using a reference on XP professional ( IIS ). XP limited to 10 sessions. How can the session be released once the method has finished. IE to log...
7
by: Arsalan | last post by:
I have a function which return datareader Public Shared Function ReturnDReader(ByVal query As String) As OleDbDataReader Dim Connection_String As String =...
7
by: What-a-Tool | last post by:
I have an mdichild form whose minimum size I want to limit (can't be dragged below a certain size) Even though I am running .NET 1.1 where the minimum size property supposedly works, it's not...
2
by: Pete Smith | last post by:
I have written print application which prints multiple pages by calling PrintPage event multiple times. I am closing all the databases related objects resources when it is not required. Since...
3
by: ssylee | last post by:
For example, I have a BITMAPINFO* and a BYTE* object to release the resources. Would the most bulletproof way of doing so involve checking to see if they are null, then if they are not, invoke a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.