Advertisement
Guest User

Helper Code

a guest
Oct 26th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.86 KB | None | 0 0
  1. Imports System.IO
  2.  
  3. Module Module1
  4.  
  5.     Private States(49) As String
  6.     Private Capitals(49) As String
  7.  
  8.     Sub Main()
  9.  
  10.     End Sub
  11.  
  12.     Public Sub ParseFile(ByVal Path As String)
  13.         Using sr As New StreamReader(Path)
  14.             For i = 0 To 49
  15.                 States(i) = sr.ReadLine()
  16.                 Capitals(i) = sr.ReadLine
  17.             Next
  18.         End Using
  19.     End Sub
  20.  
  21.     Public Function GetCaptial(ByVal State As String) As String
  22.         For i = 0 To 49
  23.             If State(i) = State Then Return Capitals(i)
  24.         Next
  25.         Return "There is no state of " & State
  26.     End Function
  27.  
  28.     Public Function GetState(ByVal Capital As String) As String
  29.         For i = 0 To 49
  30.             If Capitals(i) = Capital Then Return States(i)
  31.         Next
  32.         Return "There is no capital of " & Capital
  33.     End Function
  34. End Module
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement