Re: I'm in over my head on this one. Clarification please...



Hi David,

I recommend that you do not use your UI elements as state variables
(don't use your GUI controls to be the difinitive holder of important
imformation). Instead, you need to be keeping up with state in actual
variables or objects. Create a class or a struct that contains your
stuff, or just make them properties on your form (like a bool property
named IsConnected). In the set method of the property, you'd set the
appropriate icon on your status bar.

You need to keep track of your data in appropriately typed and named
variables or properties and your UI should be considered a
"reflection" of your state, not "definition" of your state. If you
need to examine something, you should be looking at your variables.
Your GUI elements should be changed as a side effect of setting your
actual variables and you should never look into your GUI elements to
determine what's going on, except of course, for user input controls
like text boxes and such, but then, after you collect the information
from even those types of controls, they should be stored and used in
proper variables (not the GUI elements).

Try that shift in your thought process and I'll bet things work out a
lot better for you.

--------------------------
Owner/Operator of
www.MichaelsAttic.com


On Feb 11, 1:33 pm, "David Schrader" <schra...@xxxxxxxxxxx> wrote:
Hello all,

First time in this specific NG but long time reader and applicant to
other NGs. I'm just beginning with VS2008 - a great took incidentally
- but I've run into something I've been unable to fathom. Will some-
one  be kind enough to filter out some of the sediment so I can get
clear what I need to do?

I have a program which will have an *icon* in the *status bar.* When
the application is connected to the internet I want to show one icon
but when it is disconnected I want to display a second icon.

I want to "test" to see what icon is (currently) being displayed and
toggle icons provided the condition is true or not. My code, at this
time looks like:

   If ssActivityIcon.Image = Appl.My.Resources.Resource.<IconY> Then
      ssActivityIcon.Image = Appl.My.Resources.Resource.<IconN>
   ElseIf _
      ssActivityIcon.Image = Appl.My.Resources.Resource.<IconN> Then
      ' Do nothing
   Else _
      ssActivityIcon.Image = Appl.My.Resources.Resource.<IconY>
   End If
   :
   : Do some things here... then:
   :
   If ssActivityIcon.Image = Appl.My.Resources.Resource.<IconN> Then
      ssActivityIcon.Image = Appl.My.Resources.Resource.<IconY>
   ElseIf _
      ssActivityIcon.Image = Appl.My.Resources.Resource.<IconY> Then
      ' Do nothing
   Else _
      ssActivityIcon.Image = Appl.My.Resources.Resource.<IconN>
   End If

I get the error message "Operator "=" is not defined for types
"System.Drawing.Image" and "System.Drawing.Bitmap."

I'm relatively certain that the error relates to the "IF" structure
and not the assignment(s) but I'm not certain what operation I need
to use to (or how to go about) compare comparing the names of two
different icons. I know that there's a way to do it but...

Suggestions?

David

.



Relevant Pages

  • Re: Using GUI Scripting for automated testing?
    ... interface in cases where no other tool will function. ... "see" the GUI controls on the screen could operate these ... Isn't it also obvious that such a system could operate GUI ... automate a test without having benefit of your system. ...
    (comp.software.testing)
  • [ann] WIN32GUI v1.6.3 released
    ... WIN32GUI v1.6.3 has been released. ... Win32GUI is a FREE generic library for GUI programming ... to "Win32 GUI Generics" column in C/C++ Users Journal. ... You can now access controls on a dialog, ...
    (comp.lang.cpp)
  • Re: Using GUI Scripting for automated testing?
    ... interface in cases where no other tool will function. ... You haven't provided any design details, ... This would necessarily include controls that ... Even if it is a given that your system can "find" a GUI element (which ...
    (comp.software.testing)
  • Re: Deleting older version of Windows 2000 and other questions.
    ... > Icons, speaker controls, Burner software, 2 printer controls, camera ... Those are the Icon on the right side of my task bar, ... I run ad ware and I have AdAware. ... The piece of hardware was a DVD writer. ...
    (microsoft.public.win2000.general)
  • Re: Date Picker
    ... Thanks Rick, I have it on my sheet now, but how do I make it work? ... Excel), click the Excel Options button at the bottom of the dialog that ... Developer Tab and then click the Insert icon on the Controls tab, ...
    (microsoft.public.excel.misc)