Click here to Skip to main content
15,891,513 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to access public varialbes in C# class Pin
Joe Rozario3-Sep-10 18:38
Joe Rozario3-Sep-10 18:38 
GeneralRe: How to access public varialbes in C# class Pin
Pete O'Hanlon3-Sep-10 21:43
mvePete O'Hanlon3-Sep-10 21:43 
QuestionAvoiding exceptions in socket programming Pin
Rob Philpott3-Sep-10 0:49
Rob Philpott3-Sep-10 0:49 
AnswerRe: Avoiding exceptions in socket programming Pin
Not Active3-Sep-10 1:06
mentorNot Active3-Sep-10 1:06 
GeneralRe: Avoiding exceptions in socket programming Pin
Rob Philpott3-Sep-10 1:10
Rob Philpott3-Sep-10 1:10 
GeneralRe: Avoiding exceptions in socket programming Pin
#realJSOP3-Sep-10 1:36
mve#realJSOP3-Sep-10 1:36 
AnswerRe: Avoiding exceptions in socket programming Pin
DaveyM693-Sep-10 1:35
professionalDaveyM693-Sep-10 1:35 
QuestionToolStripMenuItem.Visible always returns false? (Clarified hopefully) Pin
AussieLew2-Sep-10 17:53
AussieLew2-Sep-10 17:53 
I have just struck this. Using VS2008
private void button2_Click(object sender, EventArgs e)
            {

	    // ToolStripMenuItem.Visible always returns false?
            // This has the effect of not being able to toggle or invert the state to false by
            // assigning its negated value by use of the ! operator.
            // If the initial state is Visible = false the first click will toggle to Visible = true
            // Subsequent clicks do not change the Visible property as Visible always returns false
            // So, no matter the true state it will always set Visible = true rather than the inverse;
            

            // always returns false even if set to Visible = True
            bool cond1 = this.confirmDeletesToolStripMenuItem.Visible; 

            // always returns true
            bool cond2 = !this.confirmDeletesToolStripMenuItem.Visible; 

            MessageBox.Show(string.Format("Cond1 = {0} Cond2 = {1}",cond1,cond2));

            // try to invert the value of confirmDeletesToolStripMenuItem.Visible 
            this.confirmDeletesToolStripMenuItem.Visible = !this.confirmDeletesToolStripMenuItem.Visible;

            // still always returns false
            cond1 = this.confirmDeletesToolStripMenuItem.Visible; 

            // still always returns true
            cond2 = !this.confirmDeletesToolStripMenuItem.Visible; 

            MessageBox.Show(string.Format("Cond1 = {0} Cond2 = {1}", cond1, cond2));

            
            }



The confirmDeletesToolStripMenuItem is not the topmost menuitem.

If I get the value of any top level menu item it returns the correct value i.e True if set to Visible = True;

Whereas the lower menu levels return False even if set to True.

I would have thought that the Visible property is a reflection of whether it should be displayed rather than whether it can be seen?

I can set the Visible property directly eg this.confirmDeletesToolStripMenuItem.Visible = True; but still returns False.

Thanks for any help....
AnswerRe: ToolStripMenuItem.Visible always returns false? (Clarified hopefully) Pin
Matt U.2-Sep-10 17:59
Matt U.2-Sep-10 17:59 
GeneralRe: ToolStripMenuItem.Visible always returns false? (Clarified hopefully) Pin
AussieLew2-Sep-10 18:45
AussieLew2-Sep-10 18:45 
AnswerRe: ToolStripMenuItem.Visible always returns false? (Clarified hopefully) Pin
DaveyM695-Sep-10 7:20
professionalDaveyM695-Sep-10 7:20 
GeneralRe: ToolStripMenuItem.Visible always returns false? (Clarified hopefully) Pin
AussieLew6-Sep-10 1:49
AussieLew6-Sep-10 1:49 
GeneralRe: ToolStripMenuItem.Visible always returns false? (Clarified hopefully) Pin
DaveyM696-Sep-10 2:34
professionalDaveyM696-Sep-10 2:34 
GeneralRe: ToolStripMenuItem.Visible always returns false? (Clarified hopefully) Pin
AussieLew6-Sep-10 23:38
AussieLew6-Sep-10 23:38 
QuestionPDF based project Pin
AussieLew2-Sep-10 17:41
AussieLew2-Sep-10 17:41 
Questionwhat's in DragEventArgs in a dragdrop event Pin
Louis-Etienne Chicoine2-Sep-10 8:53
Louis-Etienne Chicoine2-Sep-10 8:53 
AnswerRe: what's in DragEventArgs in a dragdrop event Pin
Luc Pattyn2-Sep-10 9:02
sitebuilderLuc Pattyn2-Sep-10 9:02 
QuestionHow do I convert an XML response of type GetLiveCompactWeatherByUSZipCodeResponse into usable strings? Pin
SCADirector2-Sep-10 6:18
SCADirector2-Sep-10 6:18 
QuestionIs there a good example of using multiple forms..... Pin
glennPattonWork32-Sep-10 5:11
professionalglennPattonWork32-Sep-10 5:11 
AnswerRe: Is there a good example of using multiple forms..... Pin
phil.o2-Sep-10 5:31
professionalphil.o2-Sep-10 5:31 
GeneralRe: Is there a good example of using multiple forms..... Pin
glennPattonWork32-Sep-10 6:17
professionalglennPattonWork32-Sep-10 6:17 
GeneralRe: Is there a good example of using multiple forms..... Pin
#realJSOP2-Sep-10 7:10
mve#realJSOP2-Sep-10 7:10 
GeneralRe: Is there a good example of using multiple forms..... Pin
The Man from U.N.C.L.E.2-Sep-10 7:11
The Man from U.N.C.L.E.2-Sep-10 7:11 
AnswerRe: Is there a good example of using multiple forms..... Pin
Henry Minute2-Sep-10 6:22
Henry Minute2-Sep-10 6:22 
AnswerRe: Is there a good example of using multiple forms..... Pin
DaveyM692-Sep-10 6:24
professionalDaveyM692-Sep-10 6:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.