Имеются два класса в VB: Первый родительский: Code: Imports System.IO Public Class Ставки Private fs As String 'путь до файла + Protected Friend fstav(,) As String 'ставки + Private Shared fpob As String 'список победителей + Private fn As Integer 'кол-во ставок + Private Shared fsum As String ' призовой фонд + Private fofd As OpenFileDialog Dim f As Boolean = True 'просто флаг Dim k As Integer 'счетчик Public Sub New() End Sub Public Sub New(ByVal n As Integer) ReDim fstav(n - 1, 3) End Sub Public Property ofd() As OpenFileDialog Get Return fofd End Get Set(ByVal value As OpenFileDialog) fofd = value End Set End Property Public Property s() As String Get Return fs End Get Set(ByVal value As String) fs = value End Set End Property Public Property pob() As String Get Return fpob End Get Set(ByVal value As String) For i = 0 To value.Length - 1 If value.Substring(i, 1) = Space(1) Then k = k + 1 Next If k = 3 Then fpob = value k = 0 Else MsgBox("Неверно введены победители, установка победителей: 1 2 3") fpob = "1 2 3" k = 0 End If End Set End Property Public Property sum() As String Get Return fsum End Get Set(ByVal value As String) For i = 0 To value.Length - 1 If Char.IsDigit(value, i) = False Then f = False Next If f = True Then fsum = value Else f = True MsgBox("Неверно введен призовой фонд, уставновка фонда на: 1000") fsum = CStr(1000) End If End Set End Property Public Property n() As Integer Get Return fn End Get Set(ByVal value As Integer) For i = 0 To CStr(value).Length - 1 If Char.IsDigit(CStr(value), i) = False Then f = False Next If f = True Then fn = value Else f = True MsgBox("Неверно введен призовой фонд, уставновка фонда на: 1000") End End If fn = value End Set End Property Public Property stav() As String(,) Get Return fstav End Get Set(ByVal value(,) As String) fstav = value End Set End Property Public Sub readpath(ByVal ofd As OpenFileDialog, ByRef s As String) ofd.Filter = "Textfiles(*.txt)|*txt" ofd.ShowDialog() s = ofd.FileName End Sub Public Sub read(ByVal s As String, ByVal z As Integer, ByRef stav(,) As String) Dim f = New StreamReader(s) Dim line, p() As String Dim k As Integer = 0 ReDim stav(z - 1, 3) s = "C:\Users\Воробьев\Desktop\1.txt" Do While Not (f.EndOfStream) line = f.ReadLine() p = Split(line, " ") For i = 0 To UBound(p) stav(k, i) = p(i) Next k = k + 1 Loop f.Close() End Sub Public Sub readtb(ByVal tb As TextBox, ByRef o As String) o = tb.Text End Sub Public Sub vivodtb(ByVal tb As TextBox, ByVal stav(,) As String) Dim str As String For i = 0 To stav.GetLength(0) - 1 For j = 0 To stav.GetLength(1) - 1 str = str + stav(i, j) + Space(4) Next str = str + vbNewLine Next tb.Text = str End Sub Sub vivodtb(ByVal tb As TextBox, ByVal k As String) tb.Text = k End Sub End Class И второй, который "дочерний" от него: Code: Option Explicit On Public Class rez Inherits Ставки Private fstr As String Private fotv As Single Public Sub New() End Sub Public Sub New(ByVal n As Integer) ReDim Preserve stav(n - 1, 2) End Sub Public Property str() As String Get Return fstr End Get Set(ByVal value As String) fstr = value End Set End Property Public Property otv() As Single Get Return fotv End Get Set(ByVal value As Single) fotv = value End Set End Property Public Sub sravn(ByRef gr As Ставки) Dim o() As String Dim flag As Boolean Dim k As Integer = 0 o = Split(gr.pob, " ") For i = 0 To gr.stav.GetLength(0) - 1 flag = True For j = 0 To gr.stav.GetLength(1) - 2 If o(j) <> gr.stav(i, j) Then flag = False Next If flag = True Then k = k + 1 str = str + CStr(i + 1) + vbNewLine End If Next If k = 0 Then otv = "0" Else otv = (CInt(sum) / k) End If End Sub End Class Вызов из тела программы: Code: Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load g2 = New rez(Form1.g.n) g2.sravn(Form1.g) End Sub Компиляция проходит без проблем, но при работе возникает ошибка: В экземпляре объекта не задана ссылка на объект. Во втором классе в процедуре sravn в строке For i = 0 To gr.stav.GetLength(0) - 1 Делал проверку массива на значение null получил ответ true, Как можно Это исправить? Заранее спасибо!