starcraft Posted August 7, 2003 Posted August 7, 2003 How do i create a scrollable, linkable, listbox?! Quote
*Experts* Bucky Posted August 7, 2003 *Experts* Posted August 7, 2003 What do you mean, "create"? Do you want to make your own custom control from scratch, or do you just want to stick a ListBox control on your form? And what do you mean by "linkabble"? Linkable to what? Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
*Experts* Volte Posted August 7, 2003 *Experts* Posted August 7, 2003 Listboxes are already scrollable... what do you mean linkable? Do you mean so that two listboxes that syncronise their scroll positions? I think you'll need to do some of that old fasioned subclassing; create your own class which inherits the ListBox class, and override its WndProc method -- you'll need to capture the WM_VSCROLL event (I *think*) and send the same message to the other listbox. Quote
starcraft Posted August 7, 2003 Author Posted August 7, 2003 what i mean is i wont to create a list of words. And when they click on a word this will trigger an event, but its a long list to i also wont the user to be able to scroll through all the words Quote
*Experts* Volte Posted August 7, 2003 *Experts* Posted August 7, 2003 ListBoxes are scrollable by default... just add more words than it can handle and it will scroll. To make it so that clicking one of the items does something, you need to use the SelectedIndexChanged event, and check the value of ListBox1.SelectedIndex (for the index) or ListBox1.Items(ListBox1.SelectedIndex) (for the text) to see what was clicked. Quote
*Experts* Bucky Posted August 7, 2003 *Experts* Posted August 7, 2003 I know Volte is probably going to beat me to this, as he types about ten thousand WPM, but what you're trying to do is very simple. The ListBox control is already scrollable when the items in it are longer than the listbox. To make it "linkable", all you need to do is add code in the SelectedIndexChanged event. Add a Select Case statement inside the event handler to check the value of the SelectedIndex property to see which item was clicked, and act appropriately. [edit]Waaaaaaaaay too slow, even for the response. Gah.[/edit] Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
starcraft Posted August 7, 2003 Author Posted August 7, 2003 hmmm, maybe there is a simple solution to this BUT i dont know it off the top of my head. How do i tell it whent he tabpage 2 is click to start doing what you just said and when the tabpage 2 is no longer active to stop doing it? Quote
*Experts* Bucky Posted August 7, 2003 *Experts* Posted August 7, 2003 The TabControl has the same event as the ListBox, that is, SelectedIndexChanged. Add code in here that, if the selected index is 1 (the second tab), loop with a call to DoEvents in the loop until the SelectedIndex changes to something else. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
*Experts* Volte Posted August 7, 2003 *Experts* Posted August 7, 2003 Stop doing what? Just put If TabControl.SelectedTab is TabPage2 Then 'I'm not sure of the exact syntax of this 'do whatever it is you want to do End IfIt's not that hard, really. :) Quote
starcraft Posted August 7, 2003 Author Posted August 7, 2003 i get this when i try that Reference to a non-shared member requires an object reference. Quote
*Experts* Bucky Posted August 7, 2003 *Experts* Posted August 7, 2003 You need to change "TabControl" to the actual name of your control. Quote "Being grown up isn't half as fun as growing up These are the best days of our lives" -The Ataris, In This Diary
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.