问题描述
大家好,
我正在创建一个具有两个列表框的程序,每个列表框都包含一个字符串值列表.我希望能够单击listbox1中的值和listbox2中的值,并使程序将这两个项目存储在一起,以便将来知道这些项目是关联的.如果我保留在listbox1中选择的相同项目,但更改在listbox2中选择的项目,则我希望程序删除上一个链接并创建此新链接.该程序最终将在listbox1中具有所有项目的列表,每个项目都与listbox2中的1个项目相关联.
我当时在考虑使用2D数组,但这似乎很不灵活,并且想知道哪种数据结构是最好的?我正在考虑的另一个想法是数组列表,例如({listbox1item1,listbox2item4},{listbox1item2,listbox2item7})
但是我也不知道这有多实用.有没有人建议或有一种更简单的方法来做到这一点?
抱歉,如果我没有很好地说明这一点.
问候,
Stephen.
Hi All,
I''m creating a program with two listboxes, each listbox holding a list of string values. I want to be able to click on a value in listbox1 and a value in listbox2 and for the program to store these two items together so in future it will know these items are associated. If I keep the same item selected in listbox1 but change the item selected in listbox2, I would like the program to delete the previous link and create this new one. The program would eventually have a list of all the items in listbox1 each associated with 1 item in listbox2.
I was thinking of using a 2D array but this seems very inflexible and was wondering which data structure would be best? Another idea I was considering was a list of arrays, e.g. ({listbox1item1,listbox2item4} , {listbox1item2,listbox2item7})
but I''m not sure how practical this is either. Has anyone any advise or is there an easier way to do this?
Sorry if I haven''t explained this very well.
Regards,
Stephen.
推荐答案
这篇关于链接列表框中的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!