ssoni

VB. Arrays and Lists

Apr 12th, 2021
674
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form1
  2.  
  3.     Public Const CHROME_PATH = "C:\Program Files\Google\Chrome\Application\chrome.exe"
  4.  
  5.     Private Sub btnGo_Click(sender As Object, e As EventArgs) Handles btnGo.Click
  6.         Dim urls(3) As String
  7.  
  8.         urls(0) = "espn.com"
  9.         urls(1) = "youtube.com"
  10.         urls(2) = "cnn.com"
  11.         urls(3) = "schoology.com"
  12.  
  13.         For x = 0 To urls.Length - 1
  14.             Process.Start(CHROME_PATH, urls(x))
  15.         Next
  16.  
  17.     End Sub
  18.  
  19.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  20.         Dim scores(4) As Integer
  21.         Dim total As Integer
  22.         Dim avg As Decimal
  23.  
  24.         scores(0) = 99
  25.         scores(1) = 95
  26.         scores(2) = 90
  27.         scores(3) = 79
  28.         scores(4) = 100
  29.  
  30.         'total up the scores
  31.        For x = 0 To (scores.Length - 1)
  32.             total = total + scores(x)
  33.         Next
  34.  
  35.         'calc the avg
  36.        avg = total / scores.Length
  37.         avg = Math.Round(avg)
  38.  
  39.         MsgBox("The average is: " & avg)
  40.  
  41.     End Sub
  42.  
  43.     Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  44.         Dim urlList As New List(Of String)
  45.         Dim s As String
  46.  
  47.         urlList.Add("espn.com")
  48.         urlList.Add("youtube.com")
  49.         urlList.Add("cnn.com")
  50.         urlList.Add("schoology.com")
  51.  
  52.         For Each s In urlList
  53.             Process.Start(CHROME_PATH, s)
  54.         Next
  55.  
  56.     End Sub
  57. End Class
  58.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×