Click here to Skip to main content
15,911,762 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Sum algorithm Pin
Scott Page5-Apr-06 10:04
professionalScott Page5-Apr-06 10:04 
AnswerRe: Sum algorithm Pin
J4amieC5-Apr-06 9:02
J4amieC5-Apr-06 9:02 
GeneralRe: Sum algorithm Pin
Scott Page5-Apr-06 9:58
professionalScott Page5-Apr-06 9:58 
GeneralRe: Sum algorithm Pin
machman15-Apr-06 12:16
machman15-Apr-06 12:16 
AnswerRe: Sum algorithm Pin
Steve Pullan5-Apr-06 15:38
Steve Pullan5-Apr-06 15:38 
GeneralRe: Sum algorithm Pin
Scott Page6-Apr-06 2:10
professionalScott Page6-Apr-06 2:10 
GeneralRe: Sum algorithm Pin
machman16-Apr-06 3:52
machman16-Apr-06 3:52 
AnswerRe: Sum algorithm Pin
Scott Page6-Apr-06 2:39
professionalScott Page6-Apr-06 2:39 
Thanks to All for your help,

Here is the code that has worked on several target height values passed.

(Not quite sure how this "code" thing works yet)

<br />
    'This function exists within a custom collection<br />
    Public Function GetStack(ByVal height As Decimal) As GageBlockCollection<br />
        Me.ClearUsedBlocks()<br />
        Dim Stack As New GageBlockCollection<br />
        If Me.HasEqualGageBlock(height) Then<br />
            Stack.Add(Me.GetEqualGageBlock(height))<br />
            Return Stack<br />
        Else<br />
            Dim PossibleBlocks As New GageBlockCollection<br />
            If height >= 1 Then<br />
                'Height is greater than 1", so find the block that makes eliminates the inch part<br />
                For Each Block As GageBlock In Me<br />
                    If height - Block.Height > 0 AndAlso height - block.Height < 1 Then<br />
                        Block.IsUsed = True<br />
                        PossibleBlocks.Add(block)<br />
                        height -= Block.Height<br />
                    End If<br />
                Next<br />
            End If<br />
            'Find all Blocks that are smaller than height<br />
            For Each Block As GageBlock In Me<br />
                If Block.Height < height AndAlso Not Block.IsUsed Then<br />
                    PossibleBlocks.Add(block)<br />
                End If<br />
            Next<br />
            'Find combinations of blocks that are less that height<br />
            Dim Done As Boolean = False<br />
            For Each Block1 As GageBlock In PossibleBlocks<br />
                For Each Block2 As GageBlock In PossibleBlocks<br />
                    If height - (Block1.Height + Block2.Height) = 0 Then<br />
                        Block1.IsUsed = True<br />
                        Block2.IsUsed = True<br />
                        Stack.Add(Block1)<br />
                        Stack.Add(Block2)<br />
                        Done = True<br />
                        Exit For<br />
                    End If<br />
                Next<br />
                If Done Then<br />
                    Exit For<br />
                End If<br />
            Next<br />
            For Each Block As GageBlock In PossibleBlocks<br />
                If Block.IsUsed Then<br />
                    Stack.Add(block)<br />
                End If<br />
            Next<br />
            Return Stack<br />
        End If<br />
    End Function<br />


Thanks again,
Scott Page


"Some people spend an entire lifetime wondering if they made a difference. The Marines don't have that problem."
( President Ronald Reagan)
Questionhow i can redefine string Pin
Mr kilany5-Apr-06 7:09
Mr kilany5-Apr-06 7:09 
AnswerRe: how i can redefine string Pin
HaloZa5-Apr-06 7:19
HaloZa5-Apr-06 7:19 
AnswerRe: how i can redefine string Pin
FrankyT5-Apr-06 13:24
FrankyT5-Apr-06 13:24 
Questionhow can i send enter character to anothe applicatoin Pin
Mr kilany5-Apr-06 7:07
Mr kilany5-Apr-06 7:07 
AnswerRe: how can i send enter character to anothe applicatoin Pin
Chatura Dilan5-Apr-06 20:59
Chatura Dilan5-Apr-06 20:59 
QuestionAppDev Suggestions Please Pin
digicd15-Apr-06 6:09
digicd15-Apr-06 6:09 
AnswerRe: AppDev Suggestions Please Pin
J4amieC5-Apr-06 9:04
J4amieC5-Apr-06 9:04 
GeneralRe: AppDev Suggestions Please Pin
digicd15-Apr-06 9:17
digicd15-Apr-06 9:17 
Questionhow to open a binary file in VB? Pin
Mayur Gondaliya4-Apr-06 21:12
Mayur Gondaliya4-Apr-06 21:12 
QuestionUrgent help needed : Reading from a .htm file using VBScript Pin
giftsana4-Apr-06 20:30
giftsana4-Apr-06 20:30 
Questionhow to make Login Page in VB.Net Site Pin
Amit Agarrwal4-Apr-06 20:23
Amit Agarrwal4-Apr-06 20:23 
AnswerRe: how to make Login Page in VB.Net Site Pin
Chandan_Kr5-Apr-06 23:10
Chandan_Kr5-Apr-06 23:10 
Questionvb.net how to move to next tab on click of button????? Pin
Ron.S4-Apr-06 20:12
Ron.S4-Apr-06 20:12 
AnswerRe: vb.net how to move to next tab on click of button????? Pin
Dean_SF5-Apr-06 4:47
Dean_SF5-Apr-06 4:47 
AnswerRe: vb.net how to move to next tab on click of button????? Pin
machman15-Apr-06 12:26
machman15-Apr-06 12:26 
Questiondrag and drop in tablelayoutpanel Pin
shyamaprasad4-Apr-06 19:39
shyamaprasad4-Apr-06 19:39 
AnswerRe: drag and drop in tablelayoutpanel Pin
rajutri17-Nov-10 0:28
rajutri17-Nov-10 0:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.