PDA

View Full Version : Can you correct this code plz .....thank you


melissa
04-01-2009, 09:54 AM
hi there

look to this code

tbl_reg = Registry.GetValueNames(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
for j,k in tbl_reg do
ListBox.AddItem("ListBox1", k, "");
end

this code is to get startup application list into Listbox1 , but the problem is

when i click on the button the list appear again and again each time i click

i would like to correct this code and make the list appear one time not many times

thank you

longedge
04-01-2009, 09:59 AM
Try -


if not locked then
tbl_reg = Registry.GetValueNames(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
for j,k in tbl_reg do
ListBox.AddItem("ListBox1", k, "");
end
locked = true
end

mwreyf1
04-01-2009, 03:24 PM
Or just clear the lisbox every time you click.

ListBox.DeleteItem("ListBox1", LB_ALLITEMS);
tbl_reg = Registry.GetValueNames(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run");
for j,k in tbl_reg do
ListBox.AddItem("ListBox1", k, "");
end