By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,554 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,554 IT Pros & Developers. It's quick & easy.

entering data into a listbox?

P: 1
I am new to this and the book doesn't explain how to enter data from the user's input box into a listbox, the information is then to be calculated when you get all five grades into the listbox. For some reason I can't get the info to go into the listbox. Can anyone help me?
Dec 4 '07 #1
Share this Question
Share on Google+
3 Replies

P: 556
Hi there arizona, are you going to be adding these things in code? does you form have just a listbox and a button? because if it has these things you might want to try this:


Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  3.     Dim command1 As String
  4.     command1 = inputbox("AddItem")
  5.     List1.AddItem "What ever you want to add"
  6.     List1.AddItem "What ever you want to add"
  7.     'and so on
  9. End Sub
Dec 5 '07 #2

P: 556
im sorry this will only add the items as soon as you run the program not with the inputbox. maybe someone else can modify it to use the inputbox. sorry

Dec 5 '07 #3

Expert 5K+
P: 8,127
You are using inputbox or textbox for user input ?
If using inputbox then try this sample code

Expand|Select|Wrap|Line Numbers
  1. private sub command1_click()
  2. dim s1 as string,s2 as string, s3 as sting
  3. list1.clear
  4. s1=inputbox("enter grade1")
  5. list1.additem s1
  6. s2=inputbox("enter grade2")
  7. list1.additem s2
  8. s3=inputbox("enter grade3")
  9. list1.additem s3
  10. end sub
Dec 6 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.