Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Listbox Help
#1
I am making a password-storage application on Visual Basic (2008). I need to know how, when you add a list item (which I already know how to do), to also specify a password to go with it. Then when you select it on the listbox it displays the password.

Thanks!!
Reply
#2
You can use an array to store the passwords and then find the password for the selected item like this: (password() is the array)
Code:
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
     msgbox(password(listbox1.selectedindex))  
End Sub
My software company: Porosis Software
Games: Terrantula
Apps: Mathanasis, ColorGrabber
Reply
#3
"Password is not declared"...

? I only have intermediate experiance with VB... what is "password"? Should I add a textbox named password or something?
Reply
#4
You should add an array named password. You can do that by writing:
Code:
Public password() as string
This code must be added just after Public Class Form1 and not in any sub or event handler because it needs to be accessible by the whole application.
My software company: Porosis Software
Games: Terrantula
Apps: Mathanasis, ColorGrabber
Reply
#5
Alright now there are no errors but how does the user specify the password they want to go with each listbox item?

Edit: actually now when I run it and select an item off the list it crashes...
Reply
#6
You can add to the window two textboxes and name them (tb_name,tb_password) and then also add a button that says add password.
I the click event of the button add:
Code:
Listbox1.items.add(tb_name.text) 'adds the name to the list box
password.add(tb_password.text) 'adds the password
also you should change the password declaration code to:
Code:
Public password as new list(of String)
My software company: Porosis Software
Games: Terrantula
Apps: Mathanasis, ColorGrabber
Reply
#7
Thanks so much! It works now.
Reply
#8
Oh wait now I have one problem... I can't use the My.Settings feature to allow users to save it when they open the application next time. How do I do this?
Reply
#9
(03-09-2010, 11:02 PM)thanasis2028 Wrote: You can add to the window two textboxes and name them (tb_name,tb_password) and then also add a button that says add password.
I the click event of the button add:
Code:
Listbox1.items.add(tb_name.text) 'adds the name to the list box
password.add(tb_password.text) 'adds the password
also you should change the password declaration code to:
Code:
Public password as new list(of String)

ThanksBlackhat
[Image: 20r9vh4.jpg]
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  TextBox2.Text | Transfer Text to ListBox Die 3 2,673 01-02-2012, 06:09 PM
Last Post: AceInfinity
  [VB.NET] - ListBox Drag & Drop - [TUT] Fragma 10 7,732 08-25-2011, 07:02 PM
Last Post: AceInfinity
  Need some help - ListBox Counter Fragma 14 4,922 07-03-2011, 05:33 AM
Last Post: H-Q
  [How To] Remove Duplicates From A Listbox PURP 6 6,990 05-12-2011, 02:31 PM
Last Post: PURP
  Save Listbox Danny 5 2,416 04-18-2010, 12:35 AM
Last Post: RaZoR03

Forum Jump:


Users browsing this thread: 5 Guest(s)