473,804 Members | 2,201 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c# Event problem (Let me know this is event problem or not..)

Please anybody help me...

I have some serious problem..
I'm doing to keep equpiment list(string)..
In my code, there are 3 page which are having 4 equpiment ID (user
control.)
like this window FORM
=============== =============== =============== =============== ======
=
= ============= ============= ============= =============
= = equpment ID = = equpment ID = = equpment ID = =
equpment ID =
= = combo box = = combo box = = combo box = =
combo box =
= = (user object) = = (user object) = = (user object)
= = (user object) =
= ============= ============= ============= =============
=
=
=
= PAGE 1 BUTTON PAGE 2 BUTTON PAGE 3 BUTTON
=============== =============== =============== =============== ========
every userobject can select equpiment (1000,2000,3000 or 4000)
every page has 4 equpment list, so totally 12 equpment can be display
at once..
1. when combo box click(means equipment change), event is occured
2. FORM window catch event and keep equipment inforamtion at
dictionary<int, list<String>>
(int is page number, string is equipment ID)
3. if page changed, display thier (page) own equipment list
The problem is ... event...
I select 1000, 2000 ," ", " " at page 1
and change page to 2 (all user control clear because page 2 is not
select any equipment)
I select " ", 3000,4000, " " at page 2
I return select page 1
I expected 1000, 2000, " " ," " but.. result is 1000,2000,4000, " "
I do not know whay 4000 is displayed...
So i debug code...
the event was problem
I code like following...
private void comboBox1_Selec tedIndexChanged _1(object sender,
EventArgs
e)
{
equipmentID = comboBox1.Text;
equipmentChange d(new object(), new EventArgs());
//equipmentChange d(this, new EventArgs());
}
equipmentChange d is event...

If I comment out equipmentChange d event and calll event by other, the
problem is not happened...
(example I made a button on usercontrol and send event by button
click)
I want to attach the sample code but I don't know how to attach at
this usernet group..
So please down load my c# sample code and please teach me what is
problem...

http://download.yousendit.com/B1F068D56D804070
there is testWindow.zip file at that site..

I tooks 1 day to resolve this problem but I still could not found
reason..
Please.. please.. please...

Jun 19 '07 #1
3 1825
On Mon, 18 Jun 2007 17:54:04 -0700, <ct*****@gmail. comwrote:
[...]
http://download.yousendit.com/B1F068D56D804070
there is testWindow.zip file at that site..

I tooks 1 day to resolve this problem but I still could not found
reason..
Nor is it clear that you've resolved the issue in a satisfactory manner.

In any case, the problem happens because when you change the value of a
ComboBox, that can cause the SelectedIndexCh anged event to be signaled.
In your code, when the SelectedIndexCh anged event is signaled, you copy
_all_ of the current values of the ComboBox instances (via your user
control) to the current page's list of values. Of course, since you've
already changed the current page number by that point, you wind up taking
the current value of each of the ComboBox instances beyond what you've
already updated and copying those into your current page.

This is easily seen in the debugger by noting that your userControlList
for the given page does match what each ComboBox is showing you. So then
you set a breakpoint where you change the userControlList for the given
page and note that when you switch back to page 1, you actually wind up in
the EquipmentChange d() method copying values from each user control into
your current page's userControlList . This is the point at which the value
from the ComboBox on the previous page is copied to the userControlList
for the current page. And of course, moments later, you then take that
changed value to update the ComboBox again.

I think you would be well-served by practicing this scenario and others in
the debugger, so that you are better at using the debugger. IMHO, simply
putting appropriate breakpoints in the debugger and watching what happens
to your data makes it very clear what's wrong with your code.

How to fix it is another matter, but I would say as a start it is not a
good idea to copy _all_ of your values when just _one_ has changed. You
have a variety of other things that I would fix in your code, but it's
that one behavior that's causing the specific problem you're asking about.

Pete
Jun 19 '07 #2
On Mon, 18 Jun 2007 17:54:04 -0700, <ct*****@gmail. comwrote:
Please anybody help me...
And for the record...

I replied to your post _in spite of_ the number of times you posted it,
rather than _because of_ the number of times you posted it. My usual
reaction to seeing that number of repeats is to just ignore the post
altogether.
Jun 19 '07 #3
On 6 19 , 10 56 , "Peter Duniho" <NpOeStPe...@nn owslpianmk.com>
wrote:
On Mon, 18 Jun 2007 17:54:04 -0700, <cty0...@gmail. comwrote:
[...]
http://download.yousendit.com/B1F068D56D804070
there is testWindow.zip file at that site..
I tooks 1 day to resolve this problem but I still could not found
reason..

Nor is it clear that you've resolved the issue in a satisfactory manner.

In any case, the problem happens because when you change the value of a
ComboBox, that can cause the SelectedIndexCh anged event to be signaled.
In your code, when the SelectedIndexCh anged event is signaled, you copy
_all_ of the current values of the ComboBox instances (via your user
control) to the current page's list of values. Of course, since you've
already changed the current page number by that point, you wind up taking
the current value of each of the ComboBox instances beyond what you've
already updated and copying those into your current page.

This is easily seen in the debugger by noting that your userControlList
for the given page does match what each ComboBox is showing you. So then
you set a breakpoint where you change the userControlList for the given
page and note that when you switch back to page 1, you actually wind up in
the EquipmentChange d() method copying values from each user control into
your current page's userControlList . This is the point at which the value
from the ComboBox on the previous page is copied to the userControlList
for the current page. And of course, moments later, you then take that
changed value to update the ComboBox again.

I think you would be well-served by practicing this scenario and others in
the debugger, so that you are better at using the debugger. IMHO, simply
putting appropriate breakpoints in the debugger and watching what happens
to your data makes it very clear what's wrong with your code.

How to fix it is another matter, but I would say as a start it is not a
good idea to copy _all_ of your values when just _one_ has changed. You
have a variety of other things that I would fix in your code, but it's
that one behavior that's causing the specific problem you're asking about.

Pete
I have finally found out the problem and fix it by your teaching
Thanks thanks thankssssssss alot...
Jun 19 '07 #4

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

Similar topics

3
4470
by: Steve Long | last post by:
Hello, I have a VB.NET class that raises a MapSet event that passes an argument of type interop.MapObjects2.MapClass. I have a C# class that inherits from this VB.NET class. How can I handle the VB.NET event in the C# class? In VB.NET, you would just write: Handles MyBase.MapSet I would appreciate any help on this.
2
1946
by: Wavemaker | last post by:
The canonical way of declaring delegates for events is to include a parameter representing the sender as well as an EventArgs derived class (or EventArgs itself) as the second parameter representing the data that accompanies the event. For example: public delegate void MessageReceivedHandler(object sender, MessageReceivedArgs e); // ...
5
6832
by: Carlo Marchesoni | last post by:
From an aspx page (A.aspx) I open another one (B.aspx - for table lookup). When the user selects an entry in B.aspx I would like to force a button's event in A.aspx to be fired. I guess the only way is using javascript - does anybody have a sample for this ? Thanks
3
3645
by: R Millman | last post by:
under ASP.NET, single stepping in debug mode appears not to stop within event procedures. i.e. 1) Create web page with submit button and event procedure for the click event in the code behind page, 2) Breakpoint in the Page_Load, 3) debug the web page and click the submit button, 4) "step into" under debug several times, 5) The debugger does not stop at any of the statements in the click event handler. A breakpoint is needed in each...
19
3495
by: Heidi Hundåla | last post by:
Hi ! I have a Wep App in C#. Page_Unload fires after Page_Load, and it seems totally unreasonable when you want to use this event when you _leave_ the page. In my project we wanted to use the Page_Unload - event to clean up the Session variables, but when it turns out that it fires before the end, it screws up the code, and
29
15554
by: Patrick | last post by:
I have the following code, which regardless which works fine and logs to the EventViewer regardless of whether <processModel/> section of machine.config is set to username="SYSTEM" or "machine" ---Start of test.aspx---- <%@ Page language="C#" AutoEventWireup="false" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML> <HEAD>
3
3563
by: bclegg | last post by:
Hi, I am trying to use a 3rd Party telephony (Intel's CT-ADE 8.3) library in a vb.net service. The way it hangs up is to raise an Event. If you build a windows Application you can write: Sub DoSomeWork While not Hungup Do lots of good things application.doevents end While
5
1521
by: Paul Bromley | last post by:
Can someone give me a very simple example on how to do this? As an example I have a commaned button in a user control. Once this user control is placed on a form I want to be able to respond in the form to the button click on the user control. In a simple example - how do I do this. Do I need to use Delegates, and if so can you give a very simple example. Many thanks Paul Bromley
13
3523
by: Charles Law | last post by:
Mr "yEaH rIgHt" posted the following link about a week ago in answer to my question about removing event handlers. > http://www.vbinfozine.com/t_bindevt.shtml Following on from that post, the following issues still exist. The article shows how to find methods on a receiver that match the pattern OnXXXX given the sender. It loops through the sender events and tries to get methods from the receiver that match the pattern. For each one...
4
6700
by: AzizMandar | last post by:
C++ Event Coding Questions I have done some simple programs in C++ and read a lot of good C++ books (Including The C++ Programing Language, and C++ Primer) I am trying to understand and implement an Event based program and Message system. I have a very basic event engine that I'm feeling works a bit backwards. I'm looking for documents, source code, and books that may help me better understand how to implement this type of code. I am...
0
10343
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10335
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,...
0
10088
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7633
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
6862
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
5529
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
5668
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4306
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
3
3001
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.