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

  • Home
  • SEARCH
  • 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 6664271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:35:31+00:00 2026-05-26T02:35:31+00:00

I have a DGV that has its datasource set to a BindingList. There is

  • 0

I have a DGV that has its datasource set to a BindingList. There is also a ContextMenu assigned to a column in the DGV. There is a MenuItem set on the ContextMenu that calls a MessageBox on the click event.

Everything works fine and the Methods are called and the MessageBox with YesNo responses do what they are susppose to.

The problem that I am having is that when the MessageBox’s click event occurs (Yes or No) it does it’s job and goes away. If the same routine is called a second time, it again does it’s job with no problem, then reappears. If I click Yes or No it goes away. If I call it a third time the MessageBox appears again does its job and reappears twice. As if everytime it’s being called its iterating and calling itself again that amount of times. This will occur for everytime it’s called.

The BindingList is built using a Class with nested properties and all data elements are present.

I tried using just a blank MessageBox with no DialogResults and no change. I even tried using the DGV’s RaiseListChangedEvents=false in the ContextMenu click event and the DGV’s Cell Enter Click Event.

I’ve stepped through my code and and no matter what the Class with the nested properties always gets called and causes the ContextMenu’s click event to be called again and again… I figure this is by design since a BindingList will always AutoUpdate when a cell’s value is accessed or changed.

ContextMenu’s Column is a Button and is readonly.

So how do I either catch the MessageBox after it’s run the first time or stop the BindingList from auto updating. My List draws its data from a Web Reference and I handle updates through the methods provided from the API. The only reason I’m using a BindingList is because the DGV doesn’t work with just a List .

Thank you for any help or guidance. (First time posting, but have gathered and used a lot of info from here)

Here’s some code:

_requestsView.AutoGenerateColumns = false;
            _edit.DataPropertyName = "RequestId";
            _patient.DataPropertyName = "Patient";
            _dateSubmitted.DataPropertyName = "Date";
            _completedBy.DataPropertyName = "CompletedBy";
            _completedOn.DataPropertyName = "CompletedOn";
            _procedure.DataPropertyName = "Procedure";
            _stat.DataPropertyName = "Stat";
            _viewReport.DataPropertyName = "ViewReport";
            _selectedSpecialist.DataPropertyName = "SelectedSpecialist";
            _status.DataPropertyName = "Status";
            _rate.DataPropertyName = "Rating";

            _requestsView.DataSource = _requestsBinding;
// _cancelRequest_Click is ContextMenu MenuItem

void _cancelRequest_Click(object sender, EventArgs e)
    {

        MessageBox.Show("test");
    }

private void _requestsView_CellEnter(object sender, DataGridViewCellEventArgs e)
    {

        if (_requestsView.CurrentRow != null)
            if (_requestsView.CurrentRow.Cells["_viewReport"].Selected)
                try
                {
                 var requestNumber = (int)_requestsView.CurrentRow.Cells ["_viewReport"].Value;
                    var letter = Api.Client.getCompletedLetter(UseSession.SessionId,  requestNumber);
                    var convertedLetter = Convert.FromBase64String(letter);
                    var requestNumberToString = Convert.ToString(requestNumber);
                    var tmpfile = System.IO.Path.Combine(System.IO.Path.GetTempPath(), requestNumberToString + @".pdf");
                    var view = new ViewLetter(requestNumberToString, tmpfile);

                    File.WriteAllBytes(tmpfile, convertedLetter);

                    view._pdf.LoadFile(tmpfile);
                    view._pdf.PerformLayout();
                    view._pdf.Refresh();
                    view._pdf.setShowToolbar(true);
                    view._pdf.setZoom(100);
                    view.Show();
                    view.Activate();
                }
                catch (Exception ee)
                {
                    MessageBox.Show(ee.Message);
                }

        if (_requestsView.CurrentRow != null)
            if (_requestsView.CurrentRow.Cells["_edit"].Selected)
                _edit.ContextMenuStrip.Show(Cursor.Position.X, Cursor.Position.Y);

        if (_requestsView.CurrentRow != null)
            if (_requestsView.CurrentRow.Cells["_rate"].Selected)
                _rate.ContextMenuStrip.Show(Cursor.Position.X, Cursor.Position.Y);

    }

public class Requests
{
    private int _requestId;
    private DateTime _date;
    private string _patient;
    private string _completedBy;
    private string _completedOn;
    private string _procedure;
    private string _stat;
    private int _viewReport;
    private Specialists _selectedSpecialist;
    private string _status;
    private int _rating;

    public Requests()
    { }

    public Requests(string stat)
    {
        _stat = stat;
    }

    public int RequestId
    {
        get { return _requestId; }
        set { _requestId = value; }
    }

    public DateTime Date
    {
        get { return _date; }
        set { _date = value; }
    }

    public string Patient
    {
        get { return _patient; }
        set { _patient = value; }
    }

    public string CompletedBy
    {
        get { return _completedBy; }
        set { _completedBy = value; }
    }

    public string CompletedOn
    {
        get { return _completedOn; }
        set { _completedOn = value; }
    }

    public string Procedure
    {
        get { return _procedure; }
        set { _procedure = value; }
    }

    public string Stat
    {
        get { return _stat; }
        set { _stat = value; }
    }

    public int ViewReport
    {
        get { return _viewReport; }
        set { _viewReport = value; }
    }

    public Specialists SelectedSpecialist
    {
        get { return _selectedSpecialist; }
        set { _selectedSpecialist = value; }
    }

    public string Status
    {
        get { return _status; }
        set { _status = value; }
    }
    public int Rating
    {
        get { return _rating; }
        set { _rating = value; }
    }
}
  • 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-05-26T02:35:32+00:00Added an answer on May 26, 2026 at 2:35 am

    Just wanted to update this and close it. I figured out a work around that sets a boolean true or false during different stages of events being called. If the boolean is set to true I just do a return to get out of the methods.

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

Sidebar

Related Questions

I have a bound DGV that took a bit of work to get its
I have a windows form that has two DataGridViews (DGVs) that will hold 25,000+
I have a DGV I am binding to a list of objects. I set
I have a WinForms application that contains a Dataset ds and a DataGridView dgv.
I have the DGV bound to data and all the other controls properly. What
Have you ever seen any of there error messages? -- SQL Server 2000 Could
I have a datagridview that may or may not have rows selected when the
This is something that has been bugging me for a while as it is
I have a DataGridView which has different rows and columns and it work perfectly
I have a DGV with columns code and name. Depends of lenght of a

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.