Note that there are some explanatory texts on larger screens.

plurals
  1. POObject Reference Not Set
    primarykey
    data
    text
    <p>There are similar questions around here but none that fit into my my particular case scenario.</p> <p>I have a Windows Form with a Button. The button is attached to the event handler as follows:</p> <pre><code>private void mybutton_Click(object sender, EventArgs e) { // do some processing here } </code></pre> <p>In addition there is a combobox where a change in selection in supposed to trigger the button event handler as defined above.</p> <pre><code>private void mycombobox_SelectedIndexChanged(object sender, EventArgs e) { mybutton_Click(sender, e); // this is the line which pops up the dialog } </code></pre> <p>The code works exactly as intended at runtime but i get a dialog prompt at compile time which reads:</p> <blockquote> <p>object reference not set to an instance of an object</p> </blockquote> <p>There are no other errors or warning. </p> <p>A google search tells me that this message is an error caused if the program is trying to access a member of a reference type variable which is set to null.</p> <p>However when i run this code in debug mode, both the sender and event(e) variables are not null.</p> <p>So why is this dialog popping up ? </p> <p>And if this had been an error or warning - it should have shown as an error or warning but nothing of that sort happens. </p> <p>Here's the screenshot: <img src="https://i.stack.imgur.com/bfPwt.png" alt="enter image description here"></p> <p><strong>Edits: Answering Questions Raised in Comments</strong></p> <p>There are no errors as you can see in the screenshot.</p> <p>The program works great - just this pop up</p> <p>The popup is caused by the line:<code>mybutton_Click(sender, e);</code> in the combobox <code>selectedIndexChanged</code> function.</p> <p>The <code>mybutton_Click(sender, e)</code> does not use any of the arguments sender or e in the processing.</p> <p>I have not installed any VS extensions either.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload