Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8261591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:27:43+00:00 2026-06-08T03:27:43+00:00

We are developing a .NET application that uses a few custom controls. One specific

  • 0

We are developing a .NET application that uses a few custom controls.

One specific control is a simple “text editor” like control, where some content gets loaded into, based on the user’s selection.

In cases where the user modifies the text in this control, and then makes a different selection which would overwrite that content, we would like to have the usual popup saying “Do you want to save pending changes? YES/NO/CANCEL”.

I am considering which level of the application should be the one responsible for this: the control itself or the code that uses it?

I have been looking into the existing CancelEventArgs class, and considering using it, however i am not sure if this is a good fit for this specific scenario.

Example code i was thinking of:

When setting the text of the custom control, raise the “BeforeChanged” event. This will be handled and will allow to cancel the operation.

public void SetText(string text)
{
    CancelEventArgs args = new CancelEventArgs();

    // Raise the BeforeTextChanged event.
    BeforeTextChanged(args);

    // If the user cancelled the operation - do not modify text.
    // For example, user code will check if needs saving, show the popup, etc.
    if (args.Cancel)
    {
        return;
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:27:45+00:00Added an answer on June 8, 2026 at 3:27 am

    I don’t think you need to handle this with events – it will just complicate matters. This is linear problem and a dialog popup will halt the current thread and give you enough control to handle the user’s decision. The event in this scenario is the ‘UserSelectionChanged’ event. No need for more.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are developing an ASP.NET MVC Application that currently uses it's own database ApplicationData
I'm developing a server-client application that uses 3 ports [TCP SOCKET .Net 4.0].. So
I am developing large data collecting ASP.Net/Windows service application-pair that uses Microsoft SQL Server
I am developing an Asp.Net MVC application that uses Google maps to show Addresses
Hello i am currently developing a ASP.NET MVC 3 application that uses the new
We're developing a reporting application that uses asp.net-mvc (.net 4). We connect through DDTEK.Sybase
I am developing an ASP.NET server control that uses jQuery for some client side
I'm developing a .NET application that will have both a WinForms and a Silverlight
I've developing an ASP.NET application that interfaces with Google Maps and retrieves marker information
I am developing a .NET application (using C#) that needs to massage some Adobe

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.