Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

plz can someone tell me what ive done wrong?

Status
Not open for further replies.

Dhr003

Programmer
Nov 27, 2001
8
GB
ppl im new here and a beginner in vb programming, im working on a vb project to design a juke box which plays
a number of songs which is dependent on the money u enter. for example if £0.50p is enter 1 song is allowed to be selected or if £1.00 is entered 3 songs are allowed to be selected and displayed on a textbox etc. Ive started the coding but am stuck on a problem. when i enter money it should only let me select the number of songs allowed to but it doesnt it lets me keep on selecting without no error message coming up. ill paste my coding here( it isnt finished its done up to the point where im stuck) so ppl plz correct me where im goign wrong.
-----------------------------------------------------------------------------------------------------------------------------------
Private Sub cmbSong_Click()

If cmbSong.Text = "1" Then
txtsongName = "Stan"
Me.txtartistname = "Eminem"
ElseIf cmbSong.Text = "2" Then
txtsongName = "Krishna"
Me.txtartistname = "Dido"
ElseIf cmbSong.Text = "3" Then
txtsongName = "Thriller"
Me.txtartistname = "Michael Jackson"
ElseIf cmbSong.Text = "4" Then
txtsongName = "Slave 2 u"
Me.txtartistname = "Britney Spears"
ElseIf cmbSong.Text = "5" Then
txtsongName = "Lavida loka"
Me.txtartistname = "Ricky Martin"
End If

End Sub


Private Sub cmdSelectSong_Click()

Dim songName As String
Dim artistName As String
Dim counter As Integer
Dim songcount As Integer
Dim i As Integer

If Text3.Text = "0:50" Then
counter = 1
ElseIf Text3.Text = "1:00" Then
counter = 3
ElseIf Text3.Text = "2:00" Then
counter = 8
End If


Select Case counter

Case 1
songName = Me.txtsongName.Text
artistName = Me.txtartistname.Text
txtsonglist.Text = songName & vbCrLf & artistName
Case 3
counter = 0
songName = Me.txtsongName.Text
artistName = Me.txtartistname.Text
txtsonglist.Text = songName & vbCrLf & artistName
Case 8
counter = 0
songName = Me.txtsongName.Text
artistName = Me.txtartistname.Text
txtsonglist.Text = songName & vbCrLf & artistName
Case Else
MsgBox "ERROR", vbCritical
'txtartistname.Text = artistName
End Select

End Sub




Private Sub Form_Load()

MsgBox "Welcome!", vbInformation, "JukeBox Selector"
' settings for combo box initialisation values
cmbSong.AddItem "1"
cmbSong.AddItem "2"
cmbSong.AddItem "3"
cmbSong.AddItem "4"
cmbSong.AddItem "5"

End Sub

Private Sub quit_Click()

End
End Sub


Public Sub addsongtext(number As Integer)

End Sub
 
are you reducing the counter once a song is selected?
 
hey you are committing a crime against vb?
wake up, you should really figure out this silly mistakes.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top