Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
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.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

array problem plz check


  • Please log in to reply
1 reply to this topic

#1 ayush

ayush

  • Members
  • 19 posts
  • OFFLINE
  •  
  • Local time:10:18 PM

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

BC AdBot (Login to Remove)

 


#2 Romeo29

Romeo29

    Learning To Bleep


  • BC Advisor
  • 3,194 posts
  • OFFLINE
  •  
  • Gender:Not Telling
  • Location:127.0.0.1
  • Local time:11:48 AM

Posted 11 August 2009 - 07:14 AM

It seems to work for me.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users