I have the following code passing a dataView variable to a function and I am getting the following warning:
“Variable ‘cl’ is passed by reference before it has been assigned a value. A null reference exception could result at runtime.”
Function Editclass()
Dim cl As DataView
Bindclass (SqlConnection2, cl)
Return cl
End Function
Sub Bindclass(ByVal conn As SqlConnection, ByRef cl As DataView)
conn.Close()
getdata.Connection = conn
getdata.SQL = "SELECT * FROM POM_ClassView ORDER BY CLASSID"
getdata.FillGridDropDown()
cl = getdata.DataView
End Sub
How can I resolve the warning here please?
Not really a concern based on your usage, but this will fix it.