Hi,
I am really, really new to VB .NET and cant get my head around loops, can someone suggest something to add to the end of my code.
Description of Program/Events.
I would like to come up with a number generator that takes the Total number (for this example I'll say 20), divides it by 2, and does alternating additions so the end result will generate a list like this:
1, 11, 2, 12, 3, 13, 4, 14, 5, 15, 6, 16, 7, 17, 8, 18, 9, 19, 10, 20.
I can understand the arithmetic, just can't work out how to express this in code.
The end result would be save in a .Txt file (I have added a SaveFileDialog1 control, but figure I need to get the result before I work on the export)
Any pointers would be greatly appreciated.
Rick
Dim StartValue As Integer
Dim EndValue As Integer
Dim TotalValue As Integer
' Convert input to numeric variables.
StartValue = Val(StartNumTextBox.Text)
EndValue = Val(EndNumTextBox.Text)
' Set focus to field if you want End If
If Me.EndNumTextBox.Text.Trim = "" Then MessageBox.Show("Please Enter Numerals Only", "Non Numeric Character", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Me.EndNumTextBox.Focus()
If Me.StartNumTextBox.Text.Trim = "" Then MessageBox.Show("Please Enter Numerals Only", "Non Numeric Character", MessageBoxButtons.OK, MessageBoxIcon.Warning)
Me.StartNumTextBox.Focus()
' Calculate total number of pages.
TotalValue = EndValue
' Display total pages in a message box for user to check.
Dim TotalValueDisplay As Integer
If StartValue <> 1 Then
MessageBox.Show("The first page in a book SHOULD be 1")
End If
TotalValueDisplay = TotalValue.ToString("N")
MessageBox.Show("Total Number of Pages = " & EndValue & vbNewLine & vbNewLine & "(Both Documents Merged)", "Total Combined Amount", MessageBoxButtons.OK, MessageBoxIcon.Information)
Dim HalfTotal = TotalValue / 2
Dim FirstPage = StartValue
Dim SecondPage As Integer