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
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

Help
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Back to top









