Hey Guys,
So i have a form with 1 Text Box and 2 ListBox's
TextBox1 equals 300 (TargetValue)
The ListBox1 contains the following numbers;
100
150
250
7
12
9
200
5
50
I'm looking for a way of looking at that list of numbers, and finding the shortest combination to achieve my Target Value. (If it cant find and exact match, find the closest match Greater than the Target Value
Obviously we can see that its 250 + 50. But i need VB to figure this out for me, and then show me the combination it has found in ListBox2 (preferable with each number as a different item in ListBox2.
The Target Value will change, as will the list (it may be shorter, or it may be a hell of alot longer) each time i run the routine, so it needs to be pretty quick.
Has anyone got any ideas?
Thanks in advance
ChrisKustom
So i have a form with 1 Text Box and 2 ListBox's
TextBox1 equals 300 (TargetValue)
The ListBox1 contains the following numbers;
100
150
250
7
12
9
200
5
50
I'm looking for a way of looking at that list of numbers, and finding the shortest combination to achieve my Target Value. (If it cant find and exact match, find the closest match Greater than the Target Value
Obviously we can see that its 250 + 50. But i need VB to figure this out for me, and then show me the combination it has found in ListBox2 (preferable with each number as a different item in ListBox2.
The Target Value will change, as will the list (it may be shorter, or it may be a hell of alot longer) each time i run the routine, so it needs to be pretty quick.
Has anyone got any ideas?
Thanks in advance
ChrisKustom