Werdwed Sectional Moderator
Posts : 4 Join date : 2012-04-08
| Subject: {Tut.1.1}(Schylar's Visual Basic Guide) Sun Apr 08, 2012 11:38 pm | |
| Okay Assuming you have read my first post im going to start where i left off. Even though i like using rnd function i am going to use theDim rand as new randThis Subtopic is about random pictures, when learning vb one of my very first projects was a call of duty modern warfare 3 infected mini game random gun generator (i know try putting that in the title) Any way it actually took me a day or to to find how to do this. Fortunately i remember and im going to show you. lets start out with what you needDim rand as new randomDim intpicNow manually make a picture box or just code it in which ever you prefer i do it manually. Now make a button Now make a imagelist (with multi pics){nameing them makes code cleaner} In the button1 events you will need to typeintpic = rand.next(0, # of picures u have)picturebox1.image = imagelist.images(intpic)To Give an examplePublic Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim intpic Dim rand As New Random intpic = rand.Next(0, 4) PictureBox1.Image = ImageList1.Images(intpic) End Sub End ClassThis has been another hopefully helpful topic. -- Genius = Majestic Falcon + WerdwedSerials.Guro:DNeed a Serial? Hit me up | |
|