Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Var being used - help

$
0
0
Hi,

Can someone throw me a bone, I don't know a fix for this:
Code:

Warning        1        Variable 'progName' is used before it has been assigned a value. A null reference exception could result at runtime.        H:\X17-59183\PostInstall\PostInstall\SelectPrograms.vb        29        42        PostInstall
Here's me code:
Code:

Public Class SelectPrograms

    Dim Ver As String = " - v1.0.1 Beta 2"

    Private Sub SelectPrograms_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Show()
        Me.Text = "Post Install By Chris2k" + Ver

        Dim iniFile As String = Application.StartupPath + "\Start\InstallCFG.ini"
Dim sR As New IO.StreamReader(iniFile)
        Dim line, progName As String
        Dim ReadResult() As String

        If Not (System.IO.File.Exists(iniFile)) Then
            MessageBox.Show("The programs opted for this OS can't be installed as the InstallCFG.ini has not been included...")
        End If

        line = sR.ReadLine()

        Do While Not (line Is Nothing)
            ReadResult = line.Split(":") 'Split line at :

            If (ReadResult(0).ToLower() = "prog name") Then
                progName = TextBox1.Text + ReadResult(1) + Environment.NewLine
            End If

            line = sR.ReadLine() 'Move on to the next line.

            Dim Item As New ListViewItem(progName)
            Item.SubItems.Add("progDesc")
            Item.SubItems.Add("Size")

            ListView1.Items.Add(Item)
        Loop
        sR.Close()
    End Sub
End Class


Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>