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
Page 1 of 1
array problem plz check
#2
Posted 11 August 2009 - 07:14 AM
It seems to work for me.
Share this topic:
Page 1 of 1

Help


Back to top









