Question: I'm trying to kind of create a special kind of printing dialog. Basically I have radio buttons on a form, and there are two options: print all pages, or print a range of pages. The range of pages has 2 text boxes. One is to start, one is to finish. I want to take both of these boxes and make a for loop using the integer that is inputed in the buttons. 

```
ElseIf rbPageRange.Checked Then
    Dim startpage As Int32 : startpage = tbPageStart.Text
    Dim endpage As Int32 : endpage = tbPageEnd.Text
    For startpage To endpage
        'do something
    Next
End If

```

I am getting a syntax error on the `To` but I want to loop through each page and do something. How do I fix this?

Thank you very much!

Answer: 
The correct syntax of the [For...Next Statement](https://learn.microsoft.com/en-us/dotnet/visual-basic/language-reference/statements/for-next-statement) is

```
For counter As Integer = start To end
Next

```

Therefore, you should change your loop to

```
For page As Integer = startpage To endpage
    'do something with page
Next

```

---

Note, In VB you have aliases for current .NET types. E.g.:

```
.NET type             VB type alias
---------------       -------------
System.Int16     -->  Short
System.Int32     -->  Integer
System.Int64     -->  Long
System.DateTime  -->  Date

```

It is usual to write `Integer` in VB, instead of `Int32`.
Try writing it as 

```
For i as Integer = startpage To endpage Step 1
     'Do Something
Next

```

And it should work as expected.