Click here to Skip to main content
15,925,369 members
Home / Discussions / C#
   

C#

 
GeneralRe: switch case from array Pin
.gonad11-Feb-05 9:52
.gonad11-Feb-05 9:52 
GeneralThreads and exceptions Pin
Esmo200011-Feb-05 7:16
Esmo200011-Feb-05 7:16 
GeneralRe: Threads and exceptions Pin
Robert Rohde11-Feb-05 7:46
Robert Rohde11-Feb-05 7:46 
GeneralRe: Threads and exceptions Pin
Esmo200011-Feb-05 7:59
Esmo200011-Feb-05 7:59 
GeneralRe: Threads and exceptions Pin
Daniel Turini11-Feb-05 8:17
Daniel Turini11-Feb-05 8:17 
GeneralAsynchronous message processing Pin
Esmo200011-Feb-05 4:55
Esmo200011-Feb-05 4:55 
GeneralRe: Asynchronous message processing Pin
Esmo200011-Feb-05 7:15
Esmo200011-Feb-05 7:15 
GeneralVariable assignment problem... Pin
new_phoenix11-Feb-05 4:32
new_phoenix11-Feb-05 4:32 
Having a bit of a tricky problem with the contention for the assignment of the value to a variable. I would like the variable to be assigned in two ways both in the onLoad event. If the user clicks on a menu item, then it becomes checked and assigns the value based upon which of the appropriate menu items is selected. However, if the user does not select a menu item, the value is assigned based upon the application settings (as stored in an XSD/XML initialization file) when the application is opened. The question is this - how do I differentiate between whether the user has selected a MenuItem from the menu or if the user has only opened the application anew without making such a selection?

If the menu item is selected, assign the variable based upon the menu item (the assignment variable currently works), and if the user does not make such a selection, then use the XSD/XML file to assign the variable.

Example:

<br />
private void onLoad(object sender, System.EventArgs e)<br />
{<br />
   if ((mnuItem1.clicked) || (mnuItem2.clicked) ||<br />
     (mnunItem3.clicked) || (mnuItem4.clicked))<br />
   {<br />
      strVariable = [value from menu item]<br />
   }<br />
   else<br />
   {<br />
      strVariable = [value from XSD/XML initialization file]<br />
   }<br />
}<br />


Alternatively:

<br />
private void onLoad(object sender, System.EventArgs e)<br />
{<br />
   if ((MenuItem)sender).Name == "mnuItem1") || <br />
      (MenuItem)sender).Name == "mnuItem2") ||<br />
      (MenuItem)sender).Name == "mnuItem3") ||<br />
      (MenuItem)sender).Name == "mnuItem4"))<br />
   {<br />
      strVariable = [value from menu item]<br />
   }<br />
   else<br />
   {<br />
      strVariable = [value from XSD/XML initialization file]<br />
   }<br />
}<br />


Neither of the above code segments works because there is neither a .clicked nor a .name property for the MenuItem class. The code should be processed based upon whether the user selects the menu item or if the user does nothing and just allows their application settings to reload into the variable. How do I check to see whether the user made the selection from the menu, or is merely opening the application? Would really appreciate the assistance! Confused | :confused: Confused | :confused: Confused | :confused:
GeneralRe: Variable assignment problem... Pin
Daniel Turini11-Feb-05 6:53
Daniel Turini11-Feb-05 6:53 
GeneralRe: Variable assignment problem... Pin
new_phoenix11-Feb-05 9:01
new_phoenix11-Feb-05 9:01 
GeneralTaskbarNotification display problems Pin
eynkram11-Feb-05 4:27
eynkram11-Feb-05 4:27 
GeneralRe: TaskbarNotification display problems Pin
eynkram17-Feb-05 3:52
eynkram17-Feb-05 3:52 
GeneralProblem while Working with XmlValidatingReader!!!!! Pin
abcxyz8211-Feb-05 4:01
abcxyz8211-Feb-05 4:01 
GeneralRe: Problem while Working with XmlValidatingReader!!!!! Pin
Phil Hobgen11-Feb-05 22:53
Phil Hobgen11-Feb-05 22:53 
GeneralAppDomain and ResolveEventArgs Pin
Marc Clifton11-Feb-05 3:24
mvaMarc Clifton11-Feb-05 3:24 
GeneralRe: AppDomain and ResolveEventArgs Pin
Daniel Turini11-Feb-05 7:01
Daniel Turini11-Feb-05 7:01 
GeneralRe: AppDomain and ResolveEventArgs Pin
leppie11-Feb-05 9:45
leppie11-Feb-05 9:45 
Generalautomatic scroll down in rich text box Pin
kitsune_me11-Feb-05 2:57
kitsune_me11-Feb-05 2:57 
GeneralRe: automatic scroll down in rich text box Pin
leppie11-Feb-05 3:08
leppie11-Feb-05 3:08 
GeneralRe: automatic scroll down in rich text box Pin
kitsune_me11-Feb-05 18:27
kitsune_me11-Feb-05 18:27 
GeneralRe: automatic scroll down in rich text box Pin
mav.northwind11-Feb-05 4:36
mav.northwind11-Feb-05 4:36 
GeneralRe: automatic scroll down in rich text box Pin
kitsune_me11-Feb-05 5:25
kitsune_me11-Feb-05 5:25 
GeneralRe: automatic scroll down in rich text box Pin
mav.northwind11-Feb-05 6:07
mav.northwind11-Feb-05 6:07 
GeneralRe: automatic scroll down in rich text box Pin
Dave Kreskowiak11-Feb-05 9:13
mveDave Kreskowiak11-Feb-05 9:13 
GeneralRe: automatic scroll down in rich text box Pin
kitsune_me11-Feb-05 18:26
kitsune_me11-Feb-05 18:26 

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.