diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData ConstraintCollection.Add4 Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData ConstraintCollection.Add4 Example/VB/source.vb
index 14e118e7ea3..4e0ff81a131 100644
--- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData ConstraintCollection.Add4 Example/VB/source.vb
+++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData ConstraintCollection.Add4 Example/VB/source.vb
@@ -14,8 +14,8 @@ Module Module1
Private Sub AddForeignConstraint( _
ByVal dataSet As DataSet, ByVal table As DataTable)
Try
- Dim parentColumns(2) As DataColumn
- Dim childColumns(2) As DataColumn
+ Dim parentColumns(1) As DataColumn
+ Dim childColumns(1) As DataColumn
' Get the tables from the DataSet.
Dim customersTable As DataTable = _
dataSet.Tables("Customers")
diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges Example/VB/source.vb
index 3f27eb33304..bbb82e7a92f 100644
--- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges Example/VB/source.vb
+++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.GetChanges Example/VB/source.vb
@@ -21,7 +21,7 @@ Private Sub DemonstrateMerge()
Type.GetType("System.Int32"), "")
' Create DataColumn array to set primary key.
- Dim keyColumn(1) As DataColumn
+ Dim keyColumn(0) As DataColumn
Dim row As DataRow
' Create variable for temporary DataSet.
diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge Example/VB/source.vb
index 51c3043cbeb..036693fa2d1 100644
--- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge Example/VB/source.vb
+++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge Example/VB/source.vb
@@ -18,7 +18,7 @@ Public Class Form1
Dim itemColumn As New DataColumn("Item", Type.GetType("System.Int32"))
' DataColumn array to set primary key.
- Dim keyColumn(1) As DataColumn
+ Dim keyColumn(0) As DataColumn
Dim row As DataRow
' Create variable for temporary DataSet.
diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge2 Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge2 Example/VB/source.vb
index 0700241f825..fda55d2ced3 100644
--- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge2 Example/VB/source.vb
+++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge2 Example/VB/source.vb
@@ -21,7 +21,7 @@ Private Sub DemonstrateMergeMissingSchema()
Type.GetType("System.Int32"))
' DataColumn array to set primary key.
- Dim keyColumn(1) As DataColumn
+ Dim keyColumn(0) As DataColumn
Dim row As DataRow
' Create variable for temporary DataSet.
diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge3 Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge3 Example/VB/source.vb
index 5cce7e13051..a5bb6a26d67 100644
--- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge3 Example/VB/source.vb
+++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge3 Example/VB/source.vb
@@ -25,7 +25,7 @@ Private Sub DemonstrateMergeTable()
table.Columns.Add(c2)
' DataColumn array to set primary key.
- Dim keyCol(1) As DataColumn
+ Dim keyCol(0) As DataColumn
' Set primary key column.
keyCol(0) = c1
diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge4 Example/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge4 Example/VB/source.vb
index 7a03c4bf987..2f4aa101111 100644
--- a/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge4 Example/VB/source.vb
+++ b/snippets/visualbasic/VS_Snippets_ADO.NET/Classic WebData DataSet.Merge4 Example/VB/source.vb
@@ -28,7 +28,7 @@ Private Sub DemonstrateMergeTableAddSchema()
table.Columns.Add(itemColumn)
' DataColumn array to set primary key.
- Dim keyCol(1) As DataColumn
+ Dim keyCol(0) As DataColumn
' Set primary key column.
keyCol(0) = idColumn
diff --git a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDb.JetAutonumberMerge/VB/source.vb b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDb.JetAutonumberMerge/VB/source.vb
index 2487f67bb1d..5c22e31aeea 100644
--- a/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDb.JetAutonumberMerge/VB/source.vb
+++ b/snippets/visualbasic/VS_Snippets_ADO.NET/DataWorks OleDb.JetAutonumberMerge/VB/source.vb
@@ -55,7 +55,7 @@ Class Class1
categories.Columns.Add(column)
' Set the primary key on CategoryID.
- Dim pKey(1) As DataColumn
+ Dim pKey(0) As DataColumn
pKey(0) = categories.Columns("CategoryID")
categories.PrimaryKey = pKey
diff --git a/snippets/visualbasic/VS_Snippets_CFX/s_msmqtowcf/vb/client.vb b/snippets/visualbasic/VS_Snippets_CFX/s_msmqtowcf/vb/client.vb
index 6968ddd9cd1..067cd66164d 100644
--- a/snippets/visualbasic/VS_Snippets_CFX/s_msmqtowcf/vb/client.vb
+++ b/snippets/visualbasic/VS_Snippets_CFX/s_msmqtowcf/vb/client.vb
@@ -26,7 +26,7 @@ Module Client
lineItem2.quantity = 890
lineItem2.unitCost = 45.89F
- Dim lineItems(2) As PurchaseOrderLineItem
+ Dim lineItems(1) As PurchaseOrderLineItem
lineItems(0) = lineItem1
lineItems(1) = lineItem2
po.orderLineItems = lineItems
diff --git a/snippets/visualbasic/VS_Snippets_CFX/s_uechannels/vb/clientsnippets.vb b/snippets/visualbasic/VS_Snippets_CFX/s_uechannels/vb/clientsnippets.vb
index 9dd8126ea17..03271abb622 100644
--- a/snippets/visualbasic/VS_Snippets_CFX/s_uechannels/vb/clientsnippets.vb
+++ b/snippets/visualbasic/VS_Snippets_CFX/s_uechannels/vb/clientsnippets.vb
@@ -7,9 +7,9 @@ Public Class clientSnippets
Public Shared Sub Snippet11()
'
- Dim binding As CustomBinding = New CustomBinding()
+ Dim binding As New CustomBinding()
binding.Elements.Add(New HttpTransportBindingElement())
- Dim paramCollection As BindingParameterCollection = New BindingParameterCollection()
+ Dim paramCollection As New BindingParameterCollection()
binding.CanBuildChannelFactory(Of IRequestChannel)(paramCollection)
'
@@ -17,9 +17,9 @@ Public Class clientSnippets
Public Shared Sub Snippet12()
'
- Dim binding As CustomBinding = New CustomBinding()
- Binding.Elements.Add(New HttpTransportBindingElement())
- Dim bindingParameters(2) As Object
+ Dim binding As New CustomBinding()
+ binding.Elements.Add(New HttpTransportBindingElement())
+ Dim bindingParameters(1) As Object
binding.CanBuildChannelFactory(Of IRequestChannel)(bindingParameters)
'
@@ -29,11 +29,11 @@ Public Class clientSnippets
'
Dim binding As CustomBinding = New CustomBinding()
binding.Elements.Add(New HttpTransportBindingElement())
- Dim bindingParams(2) As Object
+ Dim bindingParams(1) As Object
Dim factory As IChannelFactory(Of IRequestChannel) = binding.BuildChannelFactory(Of IRequestChannel)(bindingParams)
factory.Open()
- Dim address As EndpointAddress = New EndpointAddress("http://localhost/channelApp/service")
+ Dim address As New EndpointAddress("http://localhost/channelApp/service")
Dim channel As IRequestChannel = factory.CreateChannel(address)
channel.Open()
Dim request As Message = Message.CreateMessage(MessageVersion.Default, "hello")
diff --git a/snippets/visualbasic/VS_Snippets_CFX/s_uechannels/vb/servicesnippets.vb b/snippets/visualbasic/VS_Snippets_CFX/s_uechannels/vb/servicesnippets.vb
index ca6b4e2038d..68f7f94b1a6 100644
--- a/snippets/visualbasic/VS_Snippets_CFX/s_uechannels/vb/servicesnippets.vb
+++ b/snippets/visualbasic/VS_Snippets_CFX/s_uechannels/vb/servicesnippets.vb
@@ -40,7 +40,7 @@ Namespace UE.Samples.Channel
'
Dim binding As CustomBinding = New CustomBinding()
binding.Elements.Add(New HttpTransportBindingElement())
- Dim bindingParameters(2) As Object
+ Dim bindingParameters(1) As Object
Dim listener As IChannelListener(Of IReplyChannel)
listener = binding.BuildChannelListener(Of IReplyChannel)(bindingParameters)
@@ -69,7 +69,7 @@ Namespace UE.Samples.Channel
'
Dim binding As CustomBinding = New CustomBinding()
binding.Elements.Add(New HttpTransportBindingElement())
- Dim bindingParameters(2) As Object
+ Dim bindingParameters(1) As Object
Dim listener As IChannelListener(Of IReplyChannel)
listener = binding.BuildChannelListener(Of IReplyChannel)(New Uri("http://localhost/channelApp"), bindingParameters)
'
@@ -89,7 +89,7 @@ Namespace UE.Samples.Channel
'
Dim binding As CustomBinding = New CustomBinding()
binding.Elements.Add(New HttpTransportBindingElement())
- Dim bindingParameters(2) As Object
+ Dim bindingParameters(1) As Object
Dim listener As IChannelListener(Of IReplyChannel)
listener = binding.BuildChannelListener(Of IReplyChannel)(New Uri("http://localhost/channelApp"), "http://localhost/channelApp/service", bindingParameters)
'
@@ -109,7 +109,7 @@ Namespace UE.Samples.Channel
'
Dim binding As CustomBinding = New CustomBinding()
binding.Elements.Add(New HttpTransportBindingElement())
- Dim bindingParameters(2) As Object
+ Dim bindingParameters(1) As Object
Dim listener As IChannelListener(Of IReplyChannel)
listener = binding.BuildChannelListener(Of IReplyChannel)(New Uri("http://localhost/channelApp"), "http://localhost/channelApp/service", ListenUriMode.Explicit, bindingParameters)
'
@@ -129,7 +129,7 @@ Namespace UE.Samples.Channel
'
Dim binding As CustomBinding = New CustomBinding()
binding.Elements.Add(New HttpTransportBindingElement())
- Dim bindingParameters(2) As Object
+ Dim bindingParameters(1) As Object
binding.CanBuildChannelFactory(Of IReplyChannel)(bindingParameters)
'
diff --git a/snippets/visualbasic/VS_Snippets_CFX/s_wcftomsmq/vb/snippets.vb b/snippets/visualbasic/VS_Snippets_CFX/s_wcftomsmq/vb/snippets.vb
index 16896f0927a..5f3c07cffad 100644
--- a/snippets/visualbasic/VS_Snippets_CFX/s_wcftomsmq/vb/snippets.vb
+++ b/snippets/visualbasic/VS_Snippets_CFX/s_wcftomsmq/vb/snippets.vb
@@ -29,7 +29,7 @@ Class Snippets
lineItem2.quantity = 890
lineItem2.unitCost = 45.89F
- Dim lineItems(2) As PurchaseOrderLineItem
+ Dim lineItems(1) As PurchaseOrderLineItem
lineItems(0) = lineItem1
lineItems(1) = lineItem2
diff --git a/snippets/visualbasic/VS_Snippets_CFX/samlattribute/vb/source.vb b/snippets/visualbasic/VS_Snippets_CFX/samlattribute/vb/source.vb
index 1379c013e0d..ef88a83ed2b 100644
--- a/snippets/visualbasic/VS_Snippets_CFX/samlattribute/vb/source.vb
+++ b/snippets/visualbasic/VS_Snippets_CFX/samlattribute/vb/source.vb
@@ -319,7 +319,7 @@ Namespace Microsoft.ServiceModel.Samples.Federation
'/ Proof Token
Protected Shared Function CreateProofToken(ByVal keySize As Integer) As BinarySecretSecurityToken
' Create an array to store the key bytes.
- Dim key(keySize / 8) As Byte
+ Dim key(keySize / 8 - 1) As Byte
' Create some random bytes.
Dim random As New RNGCryptoServiceProvider()
random.GetNonZeroBytes(key)
@@ -763,7 +763,7 @@ Namespace Microsoft.ServiceModel.Samples.Federation
Dim nBytes As Integer = xr.ReadContentAsBase64(temp, 0, temp.Length)
' Allocate a new array of the correct size to hold the provided entropy.
- Dim entropy(nBytes) As Byte
+ Dim entropy(nBytes - 1) As Byte
' Copy the entropy from the temporary array into the new array.
Dim i As Integer
@@ -1029,9 +1029,9 @@ Namespace Microsoft.ServiceModel.Samples.Federation
Public Shared Function ComputeCombinedKey(ByVal requestorEntropy() As Byte, ByVal issuerEntropy() As Byte, ByVal keySize As Integer) As Byte()
Dim kha As KeyedHashAlgorithm = New HMACSHA1(requestorEntropy, True)
- Dim key(keySize / 8) As Byte ' Final key
+ Dim key(keySize / 8 - 1) As Byte ' Final key
Dim a As Byte() = issuerEntropy ' A(0)
- Dim b(kha.HashSize / 8 + a.Length) As Byte ' Buffer for A(i) + seed
+ Dim b(kha.HashSize / 8 + a.Length - 1) As Byte ' Buffer for A(i) + seed
Dim i As Integer
While i < key.Length
diff --git a/snippets/visualbasic/VS_Snippets_CFX/wf_samples/vb/snippets.vb b/snippets/visualbasic/VS_Snippets_CFX/wf_samples/vb/snippets.vb
index be10bb6d74d..e20595014fe 100644
--- a/snippets/visualbasic/VS_Snippets_CFX/wf_samples/vb/snippets.vb
+++ b/snippets/visualbasic/VS_Snippets_CFX/wf_samples/vb/snippets.vb
@@ -1787,7 +1787,7 @@ Namespace WF_Snippets
Public Function SerializeToolboxItem(ByVal toolboxItem As ToolboxItem) As Object Implements IToolboxService.SerializeToolboxItem
Dim components As IComponent() = toolboxItem.CreateComponents()
- Dim activities(components.Length) As Activity
+ Dim activities(components.Length - 1) As Activity
components.CopyTo(activities, 0)
Return CompositeActivityDesigner.SerializeActivitiesToDataObject(Me.provider, activities)
diff --git a/snippets/visualbasic/VS_Snippets_CFX/wf_samples/vb/snippets24.vb b/snippets/visualbasic/VS_Snippets_CFX/wf_samples/vb/snippets24.vb
index ac1626a2e28..4b817b99270 100644
--- a/snippets/visualbasic/VS_Snippets_CFX/wf_samples/vb/snippets24.vb
+++ b/snippets/visualbasic/VS_Snippets_CFX/wf_samples/vb/snippets24.vb
@@ -1140,7 +1140,7 @@ Namespace WF_Snippets
' file opened for shared reads but no writes by anyone
fileStream = New FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read)
fileStream.Seek(0, SeekOrigin.Begin)
- Dim workflowBytes((CType(fileStream.Length, Integer))) As Byte
+ Dim workflowBytes(CInt(fileStream.Length - 1)) As Byte
' get the serialized form
fileStream.Read(workflowBytes, 0, workflowBytes.Length)
diff --git a/snippets/visualbasic/VS_Snippets_CLR/AppDomain_LoadRaw/VB/loadraw.vb b/snippets/visualbasic/VS_Snippets_CLR/AppDomain_LoadRaw/VB/loadraw.vb
index d5ef9a4141b..bdfaa8ec83d 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/AppDomain_LoadRaw/VB/loadraw.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/AppDomain_LoadRaw/VB/loadraw.vb
@@ -32,7 +32,7 @@ Module Test
' Loads the content of a file to a byte array.
Function loadFile(filename As String) As Byte()
Dim fs As New FileStream(filename, FileMode.Open)
- Dim buffer(CInt(fs.Length)) As Byte
+ Dim buffer(CInt(fs.Length - 1)) As Byte
fs.Read(buffer, 0, buffer.Length)
fs.Close()
diff --git a/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/VB/arraytypemismatch_constructor1.vb b/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/VB/arraytypemismatch_constructor1.vb
index 9ccea93daed..ff54ac23b1f 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/VB/arraytypemismatch_constructor1.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor1/VB/arraytypemismatch_constructor1.vb
@@ -25,10 +25,10 @@ Public Class ArrayTypeMisMatchConst
Shared Sub Main()
Try
- Dim myStringArray(2) As String
+ Dim myStringArray(1) As String
myStringArray.SetValue("Jones", 0)
myStringArray.SetValue("John", 1)
- Dim myIntArray(2) As Integer
+ Dim myIntArray(1) As Integer
Dim myArrayType As New ArrayTypeMisMatchConst()
myArrayType.CopyArray(myStringArray, myIntArray)
Catch e As ArrayTypeMismatchException
diff --git a/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/VB/arraytypemismatch_constructor2.vb b/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/VB/arraytypemismatch_constructor2.vb
index 5b1f82fdf8d..efc2bf27d71 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/VB/arraytypemismatch_constructor2.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor2/VB/arraytypemismatch_constructor2.vb
@@ -26,10 +26,10 @@ Public Class ArrayTypeMisMatchConst
Shared Sub Main()
Try
- Dim myStringArray(2) As String
+ Dim myStringArray(1) As String
myStringArray.SetValue("Jones", 0)
myStringArray.SetValue("John", 1)
- Dim myIntArray(2) As Integer
+ Dim myIntArray(1) As Integer
Dim myArrayType As New ArrayTypeMisMatchConst()
myArrayType.CopyArray(myStringArray, myIntArray)
Catch e As ArrayTypeMismatchException
diff --git a/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/VB/arraytypemismatch_constructor3.vb b/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/VB/arraytypemismatch_constructor3.vb
index 8e536811354..70f08beeb0e 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/VB/arraytypemismatch_constructor3.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/ArrayTypeMisMatch_Constructor3/VB/arraytypemismatch_constructor3.vb
@@ -25,10 +25,10 @@ Public Class ArrayTypeMisMatchConst
Shared Sub Main()
Try
- Dim myStringArray(2) As String
+ Dim myStringArray(1) As String
myStringArray.SetValue("Jones", 0)
myStringArray.SetValue("John", 1)
- Dim myIntArray(2) As Integer
+ Dim myIntArray(1) As Integer
Dim myArrayType As New ArrayTypeMisMatchConst()
myArrayType.CopyArray(myStringArray, myIntArray)
Catch e As ArrayTypeMismatchException
diff --git a/snippets/visualbasic/VS_Snippets_CLR/AssemblyName_SetPublicKey/VB/assemblyname_setpublickey.vb b/snippets/visualbasic/VS_Snippets_CLR/AssemblyName_SetPublicKey/VB/assemblyname_setpublickey.vb
index 3106cf812a9..4f9a83200c1 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/AssemblyName_SetPublicKey/VB/assemblyname_setpublickey.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/AssemblyName_SetPublicKey/VB/assemblyname_setpublickey.vb
@@ -63,7 +63,7 @@ Public Class AssemblyName_CodeBase
myAssemblyName.Flags = AssemblyNameFlags.PublicKey
' Get the whole contents of the 'PublicKey.snk' into a byte array.
Dim publicKeyStream As FileStream = File.Open("PublicKey.snk", FileMode.Open)
- Dim publicKey(publicKeyStream.Length) As Byte
+ Dim publicKey(publicKeyStream.Length - 1) As Byte
publicKeyStream.Read(publicKey, 0, CInt(publicKeyStream.Length))
' Provide the assembly with a public key.
myAssemblyName.SetPublicKey(publicKey)
diff --git a/snippets/visualbasic/VS_Snippets_CLR/Asynchronous_File_IO_async/vb/example2.vb b/snippets/visualbasic/VS_Snippets_CLR/Asynchronous_File_IO_async/vb/example2.vb
index 68493bc6e02..5103057dcca 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/Asynchronous_File_IO_async/vb/example2.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/Asynchronous_File_IO_async/vb/example2.vb
@@ -14,7 +14,7 @@ Class MainWindow
End Sub
Public Async Function CopyFilesAsync(Source As StreamReader, Destination As StreamWriter) As Task
- Dim buffer(4096) As Char
+ Dim buffer(4095) As Char
Dim numRead As Integer
numRead = Await Source.ReadAsync(buffer, 0, buffer.Length)
diff --git a/snippets/visualbasic/VS_Snippets_CLR/CertInfo/VB/certinfo.vb b/snippets/visualbasic/VS_Snippets_CLR/CertInfo/VB/certinfo.vb
index b88116a0942..1a764cd283e 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/CertInfo/VB/certinfo.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/CertInfo/VB/certinfo.vb
@@ -10,7 +10,7 @@ Class CertInfo
Friend Shared Function ReadFile(ByVal fileName As String) As Byte()
Dim f As New FileStream(fileName, FileMode.Open, FileAccess.Read)
Dim size As Integer = Fix(f.Length)
- Dim data(size) As Byte
+ Dim data(size - 1) As Byte
size = f.Read(data, 0, size)
f.Close()
Return data
diff --git a/snippets/visualbasic/VS_Snippets_CLR/CodeStatementCollectionExample/VB/class1.vb b/snippets/visualbasic/VS_Snippets_CLR/CodeStatementCollectionExample/VB/class1.vb
index 8ae4e987d2b..20c8907ef6f 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/CodeStatementCollectionExample/VB/class1.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/CodeStatementCollectionExample/VB/class1.vb
@@ -44,7 +44,7 @@ Public Class Class1
'
' Copies the contents of the collection beginning at index 0 to the specified CodeStatement array.
' 'statements' is a CodeStatement array.
- Dim statementArray(collection.Count) As CodeStatement
+ Dim statementArray(collection.Count - 1) As CodeStatement
collection.CopyTo(statementArray, 0)
'
diff --git a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.3DES.Createstring.Memory/VB/memoryexample.vb b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.3DES.Createstring.Memory/VB/memoryexample.vb
index f02e312b1b4..c75436d3236 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.3DES.Createstring.Memory/VB/memoryexample.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.3DES.Createstring.Memory/VB/memoryexample.vb
@@ -85,7 +85,7 @@ Module TripleDESPSample
CryptoStreamMode.Read)
' Create buffer to hold the decrypted data.
- Dim fromEncrypt(Data.Length) As Byte
+ Dim fromEncrypt(Data.Length - 1) As Byte
' Read the decrypted data out of the crypto stream
' and place it into the temporary buffer.
diff --git a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.DES.Create.Memory/VB/memoryexample.vb b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.DES.Create.Memory/VB/memoryexample.vb
index 55e8b7aec04..2ef2338bd4f 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.DES.Create.Memory/VB/memoryexample.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.DES.Create.Memory/VB/memoryexample.vb
@@ -83,7 +83,7 @@ Module DESSample
CryptoStreamMode.Read)
' Create buffer to hold the decrypted data.
- Dim fromEncrypt(Data.Length) As Byte
+ Dim fromEncrypt(Data.Length - 1) As Byte
' Read the decrypted data out of the crypto stream
' and place it into the temporary buffer.
diff --git a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.DES.Createstring.Memory/VB/memoryexample.vb b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.DES.Createstring.Memory/VB/memoryexample.vb
index 853e8b3ce9b..3e1df944b67 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.DES.Createstring.Memory/VB/memoryexample.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.DES.Createstring.Memory/VB/memoryexample.vb
@@ -85,7 +85,7 @@ Module DESPSample
CryptoStreamMode.Read)
' Create buffer to hold the decrypted data.
- Dim fromEncrypt(Data.Length) As Byte
+ Dim fromEncrypt(Data.Length - 1) As Byte
' Read the decrypted data out of the crypto stream
' and place it into the temporary buffer.
diff --git a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.Memory/VB/memoryexample.vb b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.Memory/VB/memoryexample.vb
index 8707d34dcba..bc9b4e2c213 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.Memory/VB/memoryexample.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.DESCSP.CreateEncryptor.Memory/VB/memoryexample.vb
@@ -77,7 +77,7 @@ Module DESCSPSample
CryptoStreamMode.Read)
' Create buffer to hold the decrypted data.
- Dim fromEncrypt(Data.Length) As Byte
+ Dim fromEncrypt(Data.Length - 1) As Byte
' Read the decrypted data out of the crypto stream
' and place it into the temporary buffer.
diff --git a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.RC2.Create.Memory/VB/memoryexample.vb b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.RC2.Create.Memory/VB/memoryexample.vb
index 64c2acd9f57..c436a98bbac 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.RC2.Create.Memory/VB/memoryexample.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.RC2.Create.Memory/VB/memoryexample.vb
@@ -83,7 +83,7 @@ Module RC2Sample
CryptoStreamMode.Read)
' Create buffer to hold the decrypted data.
- Dim fromEncrypt(Data.Length) As Byte
+ Dim fromEncrypt(Data.Length - 1) As Byte
' Read the decrypted data out of the crypto stream
' and place it into the temporary buffer.
diff --git a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.RC2.Createstring.Memory/VB/memoryexample.vb b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.RC2.Createstring.Memory/VB/memoryexample.vb
index ca77674e971..5c299e5bc4b 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.RC2.Createstring.Memory/VB/memoryexample.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.RC2.Createstring.Memory/VB/memoryexample.vb
@@ -85,7 +85,7 @@ Module RC2PSample
CryptoStreamMode.Read)
' Create buffer to hold the decrypted data.
- Dim fromEncrypt(Data.Length) As Byte
+ Dim fromEncrypt(Data.Length - 1) As Byte
' Read the decrypted data out of the crypto stream
' and place it into the temporary buffer.
diff --git a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.RC2CryptoServiceProvider/VB/example.vb b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.RC2CryptoServiceProvider/VB/example.vb
index 1362b7c697f..8219c2664fc 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/Cryptography.RC2CryptoServiceProvider/VB/example.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/Cryptography.RC2CryptoServiceProvider/VB/example.vb
@@ -33,7 +33,7 @@ Module MyMainModule
Dim msDecrypt As New MemoryStream(encryptedBytes)
Dim csDecrypt As New CryptoStream(msDecrypt, rc2CSP.CreateDecryptor(rc2CSP.Key, rc2CSP.IV), CryptoStreamMode.Read)
- Dim unencryptedBytes(originalBytes.Length) As Byte
+ Dim unencryptedBytes(originalBytes.Length - 1) As Byte
'Read the data out of the crypto stream.
csDecrypt.Read(unencryptedBytes, 0, unencryptedBytes.Length)
diff --git a/snippets/visualbasic/VS_Snippets_CLR/DPAPI-HowTO/vb/sample.vb b/snippets/visualbasic/VS_Snippets_CLR/DPAPI-HowTO/vb/sample.vb
index fde1583d749..1b2ea95b3e3 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/DPAPI-HowTO/vb/sample.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/DPAPI-HowTO/vb/sample.vb
@@ -177,7 +177,7 @@ Public Module MemoryProtectionSample
End If
- Dim inBuffer(Length) As Byte
+ Dim inBuffer(Length - 1) As Byte
Dim outBuffer() As Byte
' Read the encrypted data from a stream.
diff --git a/snippets/visualbasic/VS_Snippets_CLR/FInfo Open1/VB/finfo open1.vb b/snippets/visualbasic/VS_Snippets_CLR/FInfo Open1/VB/finfo open1.vb
index 722d21d0f26..67b720f8884 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/FInfo Open1/VB/finfo open1.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/FInfo Open1/VB/finfo open1.vb
@@ -21,7 +21,7 @@ Public Class Test
'Open the stream and read it back.
fs = fi.Open(FileMode.Open)
- Dim b(1024) As Byte
+ Dim b(1023) As Byte
Dim temp As UTF8Encoding = New UTF8Encoding(True)
Do While fs.Read(b, 0, b.Length) > 0
Console.WriteLine(temp.GetString(b))
diff --git a/snippets/visualbasic/VS_Snippets_CLR/FInfo Open2/VB/finfo open2.vb b/snippets/visualbasic/VS_Snippets_CLR/FInfo Open2/VB/finfo open2.vb
index 79412d16a65..64023d97647 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/FInfo Open2/VB/finfo open2.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/FInfo Open2/VB/finfo open2.vb
@@ -23,7 +23,7 @@ Public Class Test
'Open the stream and read it back.
fs = fi.Open(FileMode.Open, FileAccess.Read)
- Dim b(1024) As byte
+ Dim b(1023) As byte
Dim temp As UTF8Encoding = New UTF8Encoding(true)
Do While fs.Read(b,0,b.Length) > 0
diff --git a/snippets/visualbasic/VS_Snippets_CLR/FInfo OpenRead/VB/finfo openread.vb b/snippets/visualbasic/VS_Snippets_CLR/FInfo OpenRead/VB/finfo openread.vb
index 2ddbca4a7b1..15c95466d11 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/FInfo OpenRead/VB/finfo openread.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/FInfo OpenRead/VB/finfo openread.vb
@@ -21,7 +21,7 @@ Public Class Test
'Open the stream and read it back.
fs = fi.OpenRead()
- Dim b(1024) As Byte
+ Dim b(1023) As Byte
Dim temp As UTF8Encoding = New UTF8Encoding(True)
Do While fs.Read(b, 0, b.Length) > 0
diff --git a/snippets/visualbasic/VS_Snippets_CLR/FInfo OpenWrite/VB/file openwrite.vb b/snippets/visualbasic/VS_Snippets_CLR/FInfo OpenWrite/VB/file openwrite.vb
index 5e989758ae1..48f33551f12 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/FInfo OpenWrite/VB/file openwrite.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/FInfo OpenWrite/VB/file openwrite.vb
@@ -19,7 +19,7 @@ Public Class Test
'Open the stream and read it back.
fs = fi.OpenRead()
- Dim b(1024) As Byte
+ Dim b(1023) As Byte
Dim temp As UTF8Encoding = New UTF8Encoding(True)
Do While fs.Read(b, 0, b.Length) > 0
diff --git a/snippets/visualbasic/VS_Snippets_CLR/FStream Class/VB/fstream class.vb b/snippets/visualbasic/VS_Snippets_CLR/FStream Class/VB/fstream class.vb
index 64dfd2d4018..63dcf2bbcf4 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/FStream Class/VB/fstream class.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/FStream Class/VB/fstream class.vb
@@ -32,7 +32,7 @@ Public Class Test
'Open the stream and read it back.
fs = File.OpenRead(path)
- Dim b(1024) As Byte
+ Dim b(1023) As Byte
Dim temp As UTF8Encoding = New UTF8Encoding(True)
Do While fs.Read(b, 0, b.Length) > 0
diff --git a/snippets/visualbasic/VS_Snippets_CLR/File Open1/VB/file open1.vb b/snippets/visualbasic/VS_Snippets_CLR/File Open1/VB/file open1.vb
index 40384822922..e023416aa38 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/File Open1/VB/file open1.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/File Open1/VB/file open1.vb
@@ -15,7 +15,7 @@ Public Class Test
' Open the stream and read it back.
Using fs As FileStream = File.Open(path1, FileMode.Open)
- Dim b(1024) As Byte
+ Dim b(1023) As Byte
Dim temp As UTF8Encoding = New UTF8Encoding(True)
Do While fs.Read(b, 0, b.Length) > 0
Console.WriteLine(temp.GetString(b))
diff --git a/snippets/visualbasic/VS_Snippets_CLR/File Open2/VB/file open2.vb b/snippets/visualbasic/VS_Snippets_CLR/File Open2/VB/file open2.vb
index 307797eb909..8a17b6e7e7e 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/File Open2/VB/file open2.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/File Open2/VB/file open2.vb
@@ -22,7 +22,7 @@ Public Class Test
' Open the stream and read it back.
Using fs As FileStream = File.Open(filePath, FileMode.Open, FileAccess.Read)
- Dim b(1024) As Byte
+ Dim b(1023) As Byte
Dim temp As UTF8Encoding = New UTF8Encoding(True)
' Display the information on the console.
diff --git a/snippets/visualbasic/VS_Snippets_CLR/File Open3/VB/file open3.vb b/snippets/visualbasic/VS_Snippets_CLR/File Open3/VB/file open3.vb
index 991861e7254..cdc1d2ac7c9 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/File Open3/VB/file open3.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/File Open3/VB/file open3.vb
@@ -19,7 +19,7 @@ Public Class Test
' Open the stream and read it back.
Using fs As FileStream = File.Open(path, FileMode.Open, FileAccess.Read, FileShare.None)
- Dim b(1024) As Byte
+ Dim b(1023) As Byte
Dim temp As UTF8Encoding = New UTF8Encoding(True)
Do While fs.Read(b, 0, b.Length) > 0
diff --git a/snippets/visualbasic/VS_Snippets_CLR/File OpenRead/VB/file openread.vb b/snippets/visualbasic/VS_Snippets_CLR/File OpenRead/VB/file openread.vb
index a14429a53f4..f485069938a 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/File OpenRead/VB/file openread.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/File OpenRead/VB/file openread.vb
@@ -18,7 +18,7 @@ Public Class Test
' Open the stream and read it back.
Using fs As FileStream = File.OpenRead(path)
- Dim b(1024) As Byte
+ Dim b(1023) As Byte
Dim temp As UTF8Encoding = New UTF8Encoding(True)
Do While fs.Read(b, 0, b.Length) > 0
diff --git a/snippets/visualbasic/VS_Snippets_CLR/File OpenWrite/VB/file openwrite.vb b/snippets/visualbasic/VS_Snippets_CLR/File OpenWrite/VB/file openwrite.vb
index da61ac685de..1b63cd92aed 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/File OpenWrite/VB/file openwrite.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/File OpenWrite/VB/file openwrite.vb
@@ -17,7 +17,7 @@ Public Class Test
'Open the stream and read it back.
Using fs As FileStream = File.OpenRead(path)
- Dim b(1024) As Byte
+ Dim b(1023) As Byte
Dim temp As UTF8Encoding = New UTF8Encoding(True)
Do While fs.Read(b, 0, b.Length) > 0
diff --git a/snippets/visualbasic/VS_Snippets_CLR/HMACMD5/vb/hmacmd5.vb b/snippets/visualbasic/VS_Snippets_CLR/HMACMD5/vb/hmacmd5.vb
index 8502ea8d8fa..65812023203 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/HMACMD5/vb/hmacmd5.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/HMACMD5/vb/hmacmd5.vb
@@ -81,7 +81,7 @@ Public Class HMACMD5example
' Initialize the keyed hash object.
Using hmac As New HMACMD5(key)
' Create an array to hold the keyed hash value read from the file.
- Dim storedHash(hmac.HashSize / 8) As Byte
+ Dim storedHash(hmac.HashSize / 8 - 1) As Byte
' Create a FileStream for the source file.
Using inStream As New FileStream(sourceFile, FileMode.Open)
' Read in the storedHash.
diff --git a/snippets/visualbasic/VS_Snippets_CLR/HMACRIPEMD160/vb/hmacripemd160.vb b/snippets/visualbasic/VS_Snippets_CLR/HMACRIPEMD160/vb/hmacripemd160.vb
index 53ba45c3f7f..8e4eadd9ab7 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/HMACRIPEMD160/vb/hmacripemd160.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/HMACRIPEMD160/vb/hmacripemd160.vb
@@ -81,7 +81,7 @@ Public Class HMACRIPEMD160example
' Initialize the keyed hash object.
Using hmac As New HMACRIPEMD160(key)
' Create an array to hold the keyed hash value read from the file.
- Dim storedHash(hmac.HashSize / 8) As Byte
+ Dim storedHash(hmac.HashSize / 8 - 1) As Byte
' Create a FileStream for the source file.
Using inStream As New FileStream(sourceFile, FileMode.Open)
' Read in the storedHash.
diff --git a/snippets/visualbasic/VS_Snippets_CLR/HMACSHA1/vb/hmacsha1.vb b/snippets/visualbasic/VS_Snippets_CLR/HMACSHA1/vb/hmacsha1.vb
index 51aea99788f..fc96c75e264 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/HMACSHA1/vb/hmacsha1.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/HMACSHA1/vb/hmacsha1.vb
@@ -81,7 +81,7 @@ Public Class HMACSHA1example
' Initialize the keyed hash object.
Using hmac As New HMACSHA1(key)
' Create an array to hold the keyed hash value read from the file.
- Dim storedHash(hmac.HashSize / 8) As Byte
+ Dim storedHash(hmac.HashSize / 8 - 1) As Byte
' Create a FileStream for the source file.
Using inStream As New FileStream(sourceFile, FileMode.Open)
' Read in the storedHash.
diff --git a/snippets/visualbasic/VS_Snippets_CLR/HMACSHA256/vb/hmacsha256.vb b/snippets/visualbasic/VS_Snippets_CLR/HMACSHA256/vb/hmacsha256.vb
index 023c8cdfd5b..aa26942d9b2 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/HMACSHA256/vb/hmacsha256.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/HMACSHA256/vb/hmacsha256.vb
@@ -81,7 +81,7 @@ Public Class HMACSHA256example
' Initialize the keyed hash object.
Using hmac As New HMACSHA256(key)
' Create an array to hold the keyed hash value read from the file.
- Dim storedHash(hmac.HashSize / 8) As Byte
+ Dim storedHash(hmac.HashSize / 8 - 1) As Byte
' Create a FileStream for the source file.
Using inStream As New FileStream(sourceFile, FileMode.Open)
' Read in the storedHash.
diff --git a/snippets/visualbasic/VS_Snippets_CLR/HMACSHA384/vb/hmacsha384.vb b/snippets/visualbasic/VS_Snippets_CLR/HMACSHA384/vb/hmacsha384.vb
index 34290d623b1..b0162858527 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/HMACSHA384/vb/hmacsha384.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/HMACSHA384/vb/hmacsha384.vb
@@ -81,7 +81,7 @@ Public Class HMACSHA384example
' Initialize the keyed hash object.
Using hmac As New HMACSHA384(key)
' Create an array to hold the keyed hash value read from the file.
- Dim storedHash(hmac.HashSize / 8) As Byte
+ Dim storedHash(hmac.HashSize / 8 - 1) As Byte
' Create a FileStream for the source file.
Using inStream As New FileStream(sourceFile, FileMode.Open)
' Read in the storedHash.
diff --git a/snippets/visualbasic/VS_Snippets_CLR/HMACSHA512/vb/hmacsha512.vb b/snippets/visualbasic/VS_Snippets_CLR/HMACSHA512/vb/hmacsha512.vb
index 4210b364a7f..c91328f5fed 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/HMACSHA512/vb/hmacsha512.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/HMACSHA512/vb/hmacsha512.vb
@@ -81,7 +81,7 @@ Public Class HMACSHA5126example
' Initialize the keyed hash object.
Using hmac As New HMACSHA512(key)
' Create an array to hold the keyed hash value read from the file.
- Dim storedHash(hmac.HashSize / 8) As Byte
+ Dim storedHash(hmac.HashSize / 8 - 1) As Byte
' Create a FileStream for the source file.
Using inStream As New FileStream(sourceFile, FileMode.Open)
' Read in the storedHash.
diff --git a/snippets/visualbasic/VS_Snippets_CLR/conceptual.stringreader/vb/source.vb b/snippets/visualbasic/VS_Snippets_CLR/conceptual.stringreader/vb/source.vb
index 28af841adba..9c8f00aa502 100644
--- a/snippets/visualbasic/VS_Snippets_CLR/conceptual.stringreader/vb/source.vb
+++ b/snippets/visualbasic/VS_Snippets_CLR/conceptual.stringreader/vb/source.vb
@@ -4,7 +4,7 @@ Imports System.IO
Public Class CharsFromStr
Public Shared Sub Main()
Dim str As String = "Some number of characters"
- Dim b(str.Length) As Char
+ Dim b(str.Length - 1) As Char
Using sr As StringReader = New StringReader(str)
' Read 13 characters from the string into the array.