Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27356

VS 2010 Need suggestion/advice on what method to use in my app.

$
0
0
OK, first, sorry for the title, but I couldn't say much there as I want to explain things better here.
I have made this application called Dota Stats Simulator. You may or may not know, Dota is a game that was created as a Warcraft III Map where you control a hero that has a bunch of 'stats or properties' like damage, armor, move speed etc.

What my program does is that you select a hero from a combobox and it will show you the default hero stats, and update those stats whenever you add an item to your hero. Anyway, these stats are reflected into labels/textboxes in my program. The problem is, there are 100+ heroes in the game for which I have to show the stats, so my code went a bit long (9K+ Lines of repeated code). I'm posting a SS to have a general idea of what the program looks like.

I basically repeat the code like below.
AttackLabel.Text = HeroXAttack
ArmorLabel.Text = HeroXArmor
MoveSpeedLabel.Text = HeroXArmor
and so on for all the properties.

So my question is, What would be the best way to drammatically reduce the length of my code (I think I should be able to make the code a few thousand lines shorter, using maybe a function, adding the values for each hero stat to arrays, using enumerations, structures or anything like that, I just need a general suggestion, if I don't know how to do what you advise me to, I'll look it up in google myself, don't want to bother you with the details, just general suggestions on how to deal with a problem like this, to achieve efficiency code-wise, and if possible, performance-wise.

Attachment 98183
Attached Images
 

Viewing all articles
Browse latest Browse all 27356

Trending Articles



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