|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Really stupid question I believe...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 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. mycombox.items.add(......your string here)
-- Show quoteHide quoteDennis 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. 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. |
|||||||||||||||||||||||