Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have created a class which stores information which will be displayed within a listview. A timer calls a procedure that refreshes the listview from this class, unfortunately this creates a flickering effect.

 

'IntegerA POSSIBLY changed

IF IntegerA <> IntegerB THEN
   'refresh listview
   IntegerB = IntegerA
END IF

 

The above example would only refresh if IntegerA HAD changed. Could someone please explain how can i do something similar to this with classes please?

 

Thanks

Posted
Why not just create an integer property that you can use for comparison purposes? If you want to naturalize things a bit then you could overload the equality operators.
Posted
Thanks but I thought about that, but it just seems very amateur'ish. There must be a way of comparing two instances of the same class.
  • Leaders
Posted
I think IComparable is more meant for sorting or finding when an object is greated or less than another (Although if IComparable.CompareTo() returns a zero, it does signify equality, it is generally used for sorting of collections). Since you only want to test for equality, I recommend overriding the .Equals() method. Since you are using VB, you can't overload the = operator.
[sIGPIC]e[/sIGPIC]
Posted

In the end i remembered there was a sequence number variable in the class, i just use this to compare to an integer. Much easier :D

 

Didnt want to create an integer special though.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...