Använder du Code Behind i 1.1 eller 2.0? Finns textboxen "SearchBox"?
hej hej
Här kommer en liten basicfråga...
Jag har följande kod:
Private Sub SearchBtn_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles SearchBtn.Click
Dim searchstring As String
searchstring = SearchBox.Text ' rad 798
GetSearchData(searchstring)
End Sub
Och får detta felmeddelande:
Server Error in '/' Application.
----------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution
of the current web request. Please review the stack trace for more
information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location
of the exception can be identified using the exception stack trace
below.
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
Server._default_start.SearchBtn_Click(Object sender, ImageClickEventArgs e) in C:\Inetpub\default.aspx.vb:798
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e) +109
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +69
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
System.Web.UI.Page.ProcessRequestMain() +1292
FRÅGAN
Var och hur ska en initiering se ut?
Tack för uppmärksamheten
/ :OO
