Home All Groups Group Topic Archive Search About

Really stupid question I believe...

Author
22 Feb 2006 10:31 PM
JB
So I am beginning to dabble in the express editions that MS is offering
currently.  I am trying to write a basic program, but am having issues.  Here
is the code so far:

Public Class testprog

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BtnCalculate.Click
        Dim Total, Sum As Integer
        For Value As Integer = txtValueStart.Text() To txtValueEnd.Text()
            For Modifier As Integer = 20 To 200
                Sum = (1.09 ^ Value) * Modifier
                If Sum = Total Then
                    MessageBox.Show(Value & Modifier)
                End If
            Next Modifier
        Next Value
    End Sub
End Class

Now this in itself works fine.  the problem is, as it cycles through the
loop, the message box will come up for every match it finds (as it should). 
My problem/question is I need to find a way to dump the true statements into
preferaby a combo box that the user can than choose from.  I am unfamiliar on
how to go about doing this.  Can someone point me in the right direction?
Thanks in advance.
Jeremy

Author
22 Feb 2006 11:07 PM
JB
ok that code didn't work at all...this does though:

Public Class testprog

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles BtnCalculate.Click
        Dim Total, Sum As Integer
        Total = Me.txtTotal.Text()
        For Value As Integer = Me.txtValueStart.Text() To
Me.TxtValueEnd.Text()
            For Modifier As Integer = 20 To 200
                Sum = (1.09 ^ Value) * Modifier
                If Sum = Total Then
                    MessageBox.Show(Value.ToString() & " " &
Modifier.ToString())
                End If
            Next Modifier
        Next Value
    End Sub
End Class

now i am not sure how to move the two results to a combobox instead of
outputing in a message box.
Author
23 Feb 2006 12:26 AM
Dennis
mycombox.items.add(......your string here)
--
Dennis in Houston


Show quoteHide quote
"JB" wrote:

> ok that code didn't work at all...this does though:
>
> Public Class testprog
>
>     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles BtnCalculate.Click
>         Dim Total, Sum As Integer
>         Total = Me.txtTotal.Text()
>         For Value As Integer = Me.txtValueStart.Text() To
> Me.TxtValueEnd.Text()
>             For Modifier As Integer = 20 To 200
>                 Sum = (1.09 ^ Value) * Modifier
>                 If Sum = Total Then
>                     MessageBox.Show(Value.ToString() & " " &
> Modifier.ToString())
>                 End If
>             Next Modifier
>         Next Value
>     End Sub
> End Class
>
> now i am not sure how to move the two results to a combobox instead of
> outputing in a message box.
Author
23 Feb 2006 12:35 AM
JB
That did it.  Thank you much :)

Show quoteHide quote
"Dennis" wrote:

> mycombox.items.add(......your string here)
> --
> Dennis in Houston
>
>
> "JB" wrote:
>
> > ok that code didn't work at all...this does though:
> >
> > Public Class testprog
> >
> >     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
> > System.EventArgs) Handles BtnCalculate.Click
> >         Dim Total, Sum As Integer
> >         Total = Me.txtTotal.Text()
> >         For Value As Integer = Me.txtValueStart.Text() To
> > Me.TxtValueEnd.Text()
> >             For Modifier As Integer = 20 To 200
> >                 Sum = (1.09 ^ Value) * Modifier
> >                 If Sum = Total Then
> >                     MessageBox.Show(Value.ToString() & " " &
> > Modifier.ToString())
> >                 End If
> >             Next Modifier
> >         Next Value
> >     End Sub
> > End Class
> >
> > now i am not sure how to move the two results to a combobox instead of
> > outputing in a message box.