But it has not yet been assigned to an instance of a NetworkInterface object, so the variable's current value is Nothing.īefore you can call any methods against the variable, you must assign it to an object instance of the approriate type. Is of the type NetworkInterface and so it can only represent NetworkInterface objects. You did this by using the dimension variable keyword Dim, typing a variable name (network), typing the As keyword, and then specifying the type NetworkInterface. You have created a variable of type NetworkInterface named network. And then you are further warned that a null reference exception may occur. If you hover your mouse over this line, you will get a tooltip stating that variable 'network' has been used before it has been assigned a value. The code you've posted should be generating a little green squigly line under the word network in the line where you are trying to assign the label's text. You've taught me everything I know but not everything you know. Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged If nics Is Nothing OrElse nics.Length bytes.Length - 1 Then
Oh and you can remove the ' & computerProperties.HostName & computerProperties.DomainName & vbCrLf) It seems to work well for what you may need. I can't help you with your code but I got the following code, and altered it, from this link.