Visual Basic Help!

I Need Help Commenting On This Code!!

Page 1 of 1

10 Replies - 5312 Views - Last Post: 28 January 2005 - 11:20 AM Rate Topic: -----

#1 Clue28  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 130
  • Joined: 23-January 05

Visual Basic Help!

Posted 25 January 2005 - 11:35 AM

I Really Need Help Commenting or Reming This Code!
If You Can Help Please Do So! -Thanks!
THIS IS A 3 IMAGE SLOT MACHINE!

Dim first As Integer      ' Declares Variables
Dim second As Integer
Dim third As Integer
Dim try As Integer
Private comm2 As Integer

Private Sub imgAbout_Click()   'Shows About Form
frmAbout.Visible = True        
End Sub

Private Sub imgSpin_Click()            'Makes Slot Machine Same Size As 
If frmSlotPage.Height = 7650 Then   ' The Form.
frmSlotPage.Height = Form1.Height - 1350
End If
pic1.Picture = LoadPicture("")  ' Loads Picture Boxes As Empty
pic2.Picture = LoadPicture("")
pic3.Picture = LoadPicture("")

For comm = 3360 To 5060                              (Help!  What Is Comm!)
tmr2.Enabled = True 'turns second timer on
imgSpin.Visible = True  ' Makes The Spin Image Visible
imgSpin.Move comm                                         (What Is This Doing? ) 
Next comm                                                         (What Is Comm?)
tmr2.Enabled = False        'Turns Timer Off
For comm = 5060 To 3360 Step -1                    (What Is Comm Doing?)
tmr2.Enabled = True 'turns timer on
imgSpin.Visible = True 'Shows Spin Image
imgSpin.Move comm   ( Is This Making The Spin Button Move From, Left To Right And Back?) 
Next comm                          (What Is Comm)
tmr2.Enabled = False    ' Turns Timer Off
Randomize              'Randoms the pictures
For x = 0 To 1         (Need Help Commenting On Loop!!!) 
tmr1.Enabled = True
For y = 1 To 20 'Randoms the pictures from 1 - 20
pic1.Picture = LoadPicture(App.Path & "\m.bmp") 'Says when to load a picture from my documents
tmr1.Interval = y
pic1.Picture = LoadPicture(App.Path & "\n.bmp") 'Says when to load a picture from my documents
tmr1.Interval = y + 1
pic1.Picture = LoadPicture(App.Path & "\z.bmp") 'Says when to load a picture from my documents
Next y
tmr1.Enabled = False
myvalue = Int((3 * Rnd) + 1) 'Random Code
If myvalue = 1 Then
pic1.Picture = LoadPicture(App.Path & "\m.bmp") 'loads the picture
End If
If myvalue = 2 Then
pic1.Picture = LoadPicture(App.Path & "\n.bmp") 'loads the picture
End If
If myvalue = 3 Then
pic1.Picture = LoadPicture(App.Path & "\z.bmp") 'loads the picture
End If
first = myvalue
Next x


For x = 0 To 1
tmr1.Enabled = True
For y = 1 To 20
pic2.Picture = LoadPicture(App.Path & "\m.bmp")
tmr1.Interval = y
pic2.Picture = LoadPicture(App.Path & "\n.bmp")
tmr1.Interval = y + 1
pic2.Picture = LoadPicture(App.Path & "\z.bmp")
Next y


tmr1.Enabled = False
myvalue = Int((3 * Rnd) + 1)
If myvalue = 1 Then
pic2.Picture = LoadPicture(App.Path & "\m.bmp")
End If
If myvalue = 2 Then
pic2.Picture = LoadPicture(App.Path & "\n.bmp")
End If
If myvalue = 3 Then
pic2.Picture = LoadPicture(App.Path & "\z.bmp")
End If
second = myvalue
Next x


For x = 0 To 1
tmr1.Enabled = True
For y = 1 To 20
pic3.Picture = LoadPicture(App.Path & "\m.bmp")
tmr1.Interval = y
pic3.Picture = LoadPicture(App.Path & "\n.bmp")
tmr1.Interval = y + 1
pic3.Picture = LoadPicture(App.Path & "\z.bmp")
Next y


tmr1.Enabled = False
myvalue = Int((3 * Rnd) + 1)
If myvalue = 1 Then
pic3.Picture = LoadPicture(App.Path & "\m.bmp")
End If
If myvalue = 2 Then
pic3.Picture = LoadPicture(App.Path & "\n.bmp")
End If
If myvalue = 3 Then
pic3.Picture = LoadPicture(App.Path & "\z.bmp")
End If
Next x
third = myvalue



try = try + 1
Label1.Caption = try
If first = second Then ' This shows how many times the player has spun the reels and hasnt won!
compare = first
End If
If compare = third Then
imgSpin.Enabled = False
frmWin.Height = frmWin.Height + 1350
try = 0
Label1.Caption = try
frmWin.Show
End If
imgSpin.Enabled = True
End Sub


Private Sub imgExit_Click()
ans = MsgBox(" Are You Sure Your Ready To Leave?", 4, "Exit") 'small exit is the title (msgbox)
        If ans = 6 Then End
End Sub

Private Sub tmr2_Timer()
comm2 = tmr1.Interval
If comm2 = 1 Then
    pic1.Picture = LoadPicture(App.Path & "\m.bmp") 'Says when to load a picture from my documents
ElseIf comm2 = 2 Then
    pic1.Picture = LoadPicture(App.Path & "\n.bmp") 'Says when to load a picture from my documents
Else
    pic1.Picture = LoadPicture(App.Path & "\z.bmp") 'Says when to load a picture from my documents
End If
End Sub


Is This A Good Question/Topic? 0
  • +

Replies To: Visual Basic Help!

#2 Clue28  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 130
  • Joined: 23-January 05

Re: Visual Basic Help!

Posted 25 January 2005 - 11:40 AM

.yes

This post has been edited by Clue28: 25 January 2005 - 11:42 AM

Was This Post Helpful? 0
  • +
  • -

#3 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 250
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Visual Basic Help!

Posted 25 January 2005 - 01:37 PM

comm is an integer being used as a counter variable in a for loop. It's value is also being passed as a paramter to the Move method of the imgSpin object. the loops in question are responsible for displaying a picture chosen by random.

How extensively did you need the code commented?
Was This Post Helpful? 0
  • +
  • -

#4 Clue28  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 130
  • Joined: 23-January 05

Re: Visual Basic Help!

Posted 25 January 2005 - 08:13 PM

Amadeus, on Jan 25 2005, 01:37 PM, said:

comm is an integer being used as a counter variable in a for loop. It's value is also being passed as a paramter to the Move method of the imgSpin object. the loops in question are responsible for displaying a picture chosen by random.

How extensively did you need the code commented?

Not very just like something simple for each line...
Was This Post Helpful? 0
  • +
  • -

#5 skyhawk133  Icon User is offline

  • Head DIC Head
  • member icon

Reputation: 1949
  • View blog
  • Posts: 20,376
  • Joined: 17-March 01

Re: Visual Basic Help!

Posted 25 January 2005 - 08:21 PM

that's a lot... heh. There is a lot of comments already.
Was This Post Helpful? 0
  • +
  • -

#6 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 250
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Visual Basic Help!

Posted 25 January 2005 - 09:08 PM

I can help you comment, but can you upload the form as well? there are references to objects that are not quite clear.
Was This Post Helpful? 0
  • +
  • -

#7 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 187
  • View blog
  • Posts: 4,673
  • Joined: 26-November 04

Re: Visual Basic Help!

Posted 26 January 2005 - 04:47 AM

Comments for every line? You are ruining the whole purpose of using comments if you want to comment each and every line...FOA upload the form...it'll be a lot easier to work with yur code. Use comments only for statements where people might have trouble understanding what you are trying to do.
Infact sometimes if u want to comment an algorithm, instead of commenting it line by line, it would be better if you write multiline comments just before the algorithm begins and just give really catchy comments on some lines.

Upload the form and i'll comment yur code....i guess yu'll then get the idea of what I mean by Commenting.
Was This Post Helpful? 0
  • +
  • -

#8 Amadeus  Icon User is offline

  • g+ + -o drink whiskey.cpp
  • member icon

Reputation: 250
  • View blog
  • Posts: 13,507
  • Joined: 12-July 02

Re: Visual Basic Help!

Posted 26 January 2005 - 07:43 AM

born2c0de, on Jan 26 2005, 06:47 AM, said:

You are ruining the whole purpose of using comments if you want to comment each and every line...

How so? Commenting is used to inform other developers as to both intent and implementation. I agree that if proper programming structure is used, then commenting need not be done on a line by line basis, but that makes the assumption that the person reading the code is also a developer well versed in proper programming structure.

I would also note that the user requesting this commenting appears to have obtained the code from a third party source, and is unaware of what the code is doing. As this is likely a school project, I'm sure that comments are required by the professor to demonstrate an understanding of the code, and more to the point, to demonstrate that the code was conceived and written by the submitter. In scholastic settings, professors often want to see every significant line commented.

Proper variable naming conventions can also reduce the need for excessive comments.

In short, there's really no such thing as too many comments (unless the comments are erroneous). Can you really have too much information?
Was This Post Helpful? 0
  • +
  • -

#9 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 187
  • View blog
  • Posts: 4,673
  • Joined: 26-November 04

Re: Visual Basic Help!

Posted 26 January 2005 - 11:58 AM

i agree with you there....but do u think having a comment on every line is really necessary?
Clue28 said:"Not very just like something simple for each line..."

I feel that some obvious statements like the MessageBox can be ignored.................but yea...Amadeus has a point....what if the reader is new to programming ????
So if clue28 can just upload his form here....he can get his job done...
Was This Post Helpful? 0
  • +
  • -

#10 Clue28  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 130
  • Joined: 23-January 05

Re: Visual Basic Help!

Post icon  Posted 27 January 2005 - 09:18 PM

Hey guys.... thanks but no thanks.. i guess? lol .. i got my project finished.. but if you wanna see it i'll upload it for yahs :)

Attached File(s)


Was This Post Helpful? 0
  • +
  • -

#11 born2c0de  Icon User is offline

  • printf("I'm a %XR",195936478);
  • member icon

Reputation: 187
  • View blog
  • Posts: 4,673
  • Joined: 26-November 04

Re: Visual Basic Help!

Posted 28 January 2005 - 11:20 AM

now since yu've completed it anyway there's nothing we can do now.....After reading yur comments...I thought that there was no reason for u to ask for help anyway....
Cuz yur comments were pretty good and catchy themselves....
kudos!!!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1