Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Image as property in class

$
0
0
Hello,

I am trying to set up an image as a property of my "Player" class, just so i can modify any new "Player" i create by its properties.


This is kinda the code im using

imports system.drawing
private mImage as Image 

public property Image as Image
 get
  return mImage
 end get
 set (value as Image)
  mImage = value
Playerob.image = mImage 'Player ob is declared as picturebox somewhere else.

 end set
end property



Im asigning the variables 'linking' them to a new picturebox. Ex: Playerob.name = mName, Playerob.image = mImage... So any change that is make to the property modifies the picturebox itself.

Every single one of the properties but image works well whit this method im using. that means i can put
"Player1.Width = 20" and it works like a charm. But i cant modify the image and it doesnt even appear if i dont put this line of code
Playerob.image = mImage 'Player ob is declared as picturebox somewhere else.


Into the function that creates the player.

Thank you all

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>