sub main missing.
I was write the code. i.e.
------------
Imports System.IO
Imports System.Windows.Forms
Imports System.Drawing
Public Class FrmRollTwellveDice
Inherits System.Windows.Forms.Form
'button for rolling dice
Friend WithEvents cmdRoll As System.Windows.Forms.Button
'Labels to display die images
Friend WithEvents lblDie1 As System.Windows.Forms.Label
Friend WithEvents lblDie2 As System.Windows.Forms.Label
Friend WithEvents lblDie3 As System.Windows.Forms.Label
Friend WithEvents lblDie4 As System.Windows.Forms.Label
Friend WithEvents lblDie5 As System.Windows.Forms.Label
Friend WithEvents lblDie6 As System.Windows.Forms.Label
Friend WithEvents lblDie7 As System.Windows.Forms.Label
Friend WithEvents lblDie8 As System.Windows.Forms.Label
Friend WithEvents lblDie9 As System.Windows.Forms.Label
Friend WithEvents lblDie10 As System.Windows.Forms.Label
Friend WithEvents lblDie11 As System.Windows.Forms.Label
Friend WithEvents lblDie12 As System.Windows.Forms.Label
'display roll frequencies
Friend WithEvents displayTextBox As _
System.Windows.Forms.TextBox
'Visual Studio .NET generated code
'declarations
Dim randomObject As Random = New Random
Dim ones, twos, threes, fours, fives, sixes As Integer
Private Sub cmdRoll_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles cmdRoll.Click
'assign random faces to 12 dice using DisplayDice
DisplayDie(lblDie1)
DisplayDie(lblDie2)
DisplayDie(lblDie3)
DisplayDie(lblDie4)
DisplayDie(lblDie5)
DisplayDie(lblDie6)
DisplayDie(lblDie7)
DisplayDie(lblDie8)
DisplayDie(lblDie9)
DisplayDie(lblDie10)
DisplayDie(lblDie11)
DisplayDie(lblDie12)
Dim total As Integer = ones + twos + threes + fours + fives + sixes
Dim output As String
'display frequencies of faces
output = "Face" & vbTab & vbTab & "Frequency" & vbTab & "percent"
output &= vbCrLf & "1" & vbTab & vbTab & ones & _
vbTab & vbTab & String.Format("{0:P}", ones / total)
output &= vbCrLf & "2" & vbTab & vbTab & twos & _
vbTab & vbTab & String.Format("{0:P}", twos / total)
output &= vbCrLf & "3" & vbTab & vbTab & threes & _
vbTab & vbTab & String.Format("{0:P}", threes / total)
output &= vbCrLf & "4" & vbTab & vbTab & fours & _
vbTab & vbTab & String.Format("{0:P}", fours / total)
output &= vbCrLf & "5" & vbTab & vbTab & fives & _
vbTab & vbTab & String.Format("{0:P}", fives / total)
output &= vbCrLf & "6" & vbTab & vbTab & sixes & _
vbTab & vbTab & String.Format("{0:P}", sixes / total) & vbCrLf
displayTextBox.Text = output
End Sub 'cmdRoll_Click
'displlay a single die image
Sub DisplayDie(ByVal dieLabel As Label)
Dim face As Integer = randomObject.Next(1, 7)
dieLabel.Image = _
Image.FromFile(Directory.GetCurrentDirectory & _
"\Images\die" & face & ".png")
'maintain count of die faces
Select Case face
Case 1
ones += 1
Case 2
twos += 1
Case 3
threes += 1
Case 4
fours += 1
Case 5
fives += 1
Case 6
sixes += 1
End Select
End Sub 'DisplayDie
End Class
-------------
Now the problem is that when I run this code it shows the error which is
'Sub Main' was not found in '_6RollTwelveDice16.Module1'.
Please anybody solve my problem.
|