I'm brand new to this forum and have not yet trolled through all the posts so bear with me please.
I am a beginner at VB.Net programming (using VB express 2008) and (of course) am having some trouble with a particular assignment for my programming class.
I am trying to enumerate an array as simply as possible but I lack some experience. I am not allowed to use anything predefined to create this list. but here goes.
This is the code I have so far:
Expand|Select|Wrap|Line Numbers
- Private Sub btnCalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalc.Click
- Dim rows As Integer
- Dim Sum As Integer
- Dim Spacing As Integer
- Dim Pins As Integer
- Dim Cost As Integer
- Dim Revenue As Integer
- Dim Profit As Integer
- Dim Average As Integer
- Dim counter As Integer
- Pins = 'Here's where the breakdown occurs...How do I make the program (while enumerating columns) prompt me for Pins values?
- counter = 0
- Sum = 0
- rows = numIterations.Value And rows <> 0
- If rows >= 1 Then
- Spacing = Int(1000 / rows)
- End If
- Do Until (Int(rows) >= rows)
- counter = counter + 1
- While (counter <= rows)
- For Spacing = 1 To 1000 Step 2
- Next
- Cost = 100000 + 12 * Pins
- Revenue = Pins * (1000 - Pins)
- Profit = Revenue - Cost
- Sum = Sum + Profit
- End While
- Loop
- txtTable.AppendText("Number " & "Cost " & "Revenue " & "Profit ")
- txtTable.AppendText(ControlChars.CrLf)
- If rows >= 1 Then
- Average = Sum / rows
- End If
- txtTable.AppendText(ControlChars.CrLf)
- txtTable.AppendText(ControlChars.CrLf)
- txtTable.AppendText("Average Profit: " & FormatCurrency(Average).ToString())
- End Sub
I realize this topic is probably beaten to death but at this point anything I can get by way of advice or a nod in the right direction is helpful...as for the grade on this assignment...I don't even care about it - I just want to know so I can get it right.
Thanks in advance