0

Hello!

I'm declaring a line at the top of my code window.

Dim sTemp as String = textbox1.text

I have no idea why. I tried commenting a few things related to the code but none of it makes it work.

Any ideas?

Edited by Olivis: n/a

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by Olivis
0

If your code looks like this then

Public Class Form1
   Dim sTemp as String = textbox1.text
End Class

The text box has not been created yet. Move the line into the Constructor or Load Event

Public Class Form1
    Private sTemp As String

    Sub New()

        ' This call is required by the Windows Form Designer.
        InitializeComponent()

        ' Add any initialization after the InitializeComponent() call.
        sTemp = TextBox1.Text
    End Sub

End Class
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.