BleepingComputer.com: array problem plz check

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

array problem plz check

#1 User is offline   ayush 

  • Member
  • PipPip
  • Find Topics
  • Group: Members
  • Posts: 19
  • Joined: 09-August 09

Posted 09 August 2009 - 02:05 PM

iam giving a project written in vb 6 and u guys please check it where is the problem and post the correct coding also


u just need to draw one textbox with name text1.text and a command button with command1

codes are like this


'in this code i am making an array which is used to store the codes of the products but
'the array doesnot store the value for the entire program
Dim i, j As Integer
Private Sub Command1_Click()
Dim code(1 To 10) As String
For j = 1 To 10
If Text1.Text = code(j) Then
a = 1
Exit For
Else: a = 0
End If
Next
If a = 1 Then
MsgBox "u have already purchased this item"
ElseIf a = 0 Then
code(i) = Text1.Text
End If
i = i + 1
MsgBox (code(1)) 'error comes here


End Sub

Private Sub Form_Load()
i = 1
End Sub
'i am telling u what i did. in textbox i first wrote 123 and preesed the command button
'and then a message box comes saying 123 is my first element of the array. then i
'changed the no to 456 and i again did th same process but now a blank message box
'comes even i wrote the code to give value of first element

#2 User is offline   Romeo29 

  • Learning To Bleep
  • PipPipPipPipPipPip
  • Find Topics
  • Group: BC Advisor
  • Posts: 2,834
  • Joined: 06-July 08
  • Gender:Not Telling
  • Location:127.0.0.1

Posted 11 August 2009 - 07:14 AM


Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users