Myriad_Rocker
Questioning Reality
- Local time
- Yesterday, 22:38
- Joined
- Mar 26, 2004
- Messages
- 166
Just when you think you have something figured out, BAM. You get slammed with something else you wouldn't expect.
I have a list box that is populated with the days of the week. I have a msg box popping up telling me the value of the item I click on right after I click it. I'm storing that index using the ListIndex property into a long variable called selectedday. Works fine within that sub. If I pick Wednesday, it returns Wednesday in the msg box.
However, I also have a button on the form that I'm trying to get to return the value of the selection when I click on it. I use the ListIndex property again to load the index of the selection into a new long variable. However, the ListIndex is ALWAYS -1. No matter what I select in the list box, the ListIndex always remains -1 in my button click sub.
I have a work around going right now where my selectedday long variable is in the general declarations section. It works fine there. But...why won't it work the other way?
I have a list box that is populated with the days of the week. I have a msg box popping up telling me the value of the item I click on right after I click it. I'm storing that index using the ListIndex property into a long variable called selectedday. Works fine within that sub. If I pick Wednesday, it returns Wednesday in the msg box.
However, I also have a button on the form that I'm trying to get to return the value of the selection when I click on it. I use the ListIndex property again to load the index of the selection into a new long variable. However, the ListIndex is ALWAYS -1. No matter what I select in the list box, the ListIndex always remains -1 in my button click sub.
I have a work around going right now where my selectedday long variable is in the general declarations section. It works fine there. But...why won't it work the other way?