All
When I try to get the text from my listbox I am get an
error which is listed below.
Any ideas?
Thanks
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:
Line 83: 'Need to bind the textboxes from the
choice picked out from the list
Line 84: ' Dim ListItem As ListItem =
lstUsers.SelectedItem
Line 85: UserName.Text = stUsers.SelectedItem.Text
Line 86:
Line 87: 'Get the user details and fill textboxes
Source File: C:\Dev\Asset Register
SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset
Register\AssetRegister\ViewUsers.aspx.vb Line: 85
Stack Trace:
[NullReferenceException: Object reference not set to an
instance of an object.]
AssetRegister.ViewUser.lstUsers_SelectedIndexChang ed
(Object sender, EventArgs e) in C:\Dev\Asset Register
SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset
Register\AssetRegister\ViewUsers.aspx.vb:85
System.Web.UI.WebControls.ListControl.OnSelectedIn dexChang
ed(EventArgs e)
System.Web.UI.WebControls.ListBox.System.Web.UI.IP ostBackD
ataHandler.RaisePostDataChangedEvent()
System.Web.UI.Page.RaiseChangedEvents()
System.Web.UI.Page.ProcessRequestMain() 10 2138
Unless an Item has been selected, this value will be null.
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer http://www.takempis.com
The more I learn, the less I know.
"yop" <yo*@oceanfree.net> wrote in message
news:0a****************************@phx.gbl... All
When I try to get the text from my listbox I am get an error which is listed below.
Any ideas?
Thanks
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:
Line 83: 'Need to bind the textboxes from the choice picked out from the list Line 84: ' Dim ListItem As ListItem = lstUsers.SelectedItem Line 85: UserName.Text = stUsers.SelectedItem.Text Line 86: Line 87: 'Get the user details and fill textboxes
Source File: C:\Dev\Asset Register SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset Register\AssetRegister\ViewUsers.aspx.vb Line: 85
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] AssetRegister.ViewUser.lstUsers_SelectedIndexChang ed (Object sender, EventArgs e) in C:\Dev\Asset Register SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset Register\AssetRegister\ViewUsers.aspx.vb:85
System.Web.UI.WebControls.ListControl.OnSelectedIn dexChang ed(EventArgs e)
System.Web.UI.WebControls.ListBox.System.Web.UI.IP ostBackD ataHandler.RaisePostDataChangedEvent() System.Web.UI.Page.RaiseChangedEvents() System.Web.UI.Page.ProcessRequestMain()
Kevin
I have an item selected alright, daft idea but could it
be something to do with postback or something?
I click on the item and call the following:
Private Sub lstUsers_SelectedIndexChanged(ByVal sender As
Object, ByVal e As System.EventArgs) _
Handles lstUsers.SelectedIndexChanged
'Need to bind the textboxes from the choice picked out
from the list
UserName.Text = lstUsers.SelectedItem.Text
thanks -----Original Message----- Unless an Item has been selected, this value will be
null. -- HTH,
Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com The more I learn, the less I know.
"yop" <yo*@oceanfree.net> wrote in message news:0a****************************@phx.gbl... All
When I try to get the text from my listbox I am get an error which is listed below.
Any ideas?
Thanks
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:
Line 83: 'Need to bind the textboxes from the choice picked out from the list Line 84: ' Dim ListItem As ListItem = lstUsers.SelectedItem Line 85: UserName.Text =
stUsers.SelectedItem.Text Line 86: Line 87: 'Get the user details and fill
textboxes Source File: C:\Dev\Asset Register SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset Register\AssetRegister\ViewUsers.aspx.vb Line: 85
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] AssetRegister.ViewUser.lstUsers_SelectedIndexChang ed (Object sender, EventArgs e) in C:\Dev\Asset Register SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset Register\AssetRegister\ViewUsers.aspx.vb:85
System.Web.UI.WebControls.ListControl.OnSelectedIn dexChang ed(EventArgs e)
System.Web.UI.WebControls.ListBox.System.Web.UI.IP ostBackD ataHandler.RaisePostDataChangedEvent() System.Web.UI.Page.RaiseChangedEvents() System.Web.UI.Page.ProcessRequestMain()
.
Try using .SelectedValue property.....
TextBox1.Text = ListBox1.SelectedValue()
If it fails too, i would check whether it is selected the
first time user comes on the web page. If that is also
set, and it is not working, i will try to see
whether "value" property returns anything. If that fails,
i have no idea why its not working.....
Since it is going to "SelectedIndexChanged" event i am
hoping that the "AutoPostBack" is set to true for your
control.
Thanks,
Tapasvi -----Original Message----- Kevin
I have an item selected alright, daft idea but could it be something to do with postback or something?
I click on the item and call the following:
Private Sub lstUsers_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles lstUsers.SelectedIndexChanged
'Need to bind the textboxes from the choice picked out from the list UserName.Text = lstUsers.SelectedItem.Text
thanks
-----Original Message----- Unless an Item has been selected, this value will be null. -- HTH,
Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com The more I learn, the less I know.
"yop" <yo*@oceanfree.net> wrote in message news:0a****************************@phx.gbl... All
When I try to get the text from my listbox I am get an error which is listed below.
Any ideas?
Thanks
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:
Line 83: 'Need to bind the textboxes from the choice picked out from the list Line 84: ' Dim ListItem As ListItem = lstUsers.SelectedItem Line 85: UserName.Text =stUsers.SelectedItem.Text Line 86: Line 87: 'Get the user details and filltextboxes Source File: C:\Dev\Asset Register SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset Register\AssetRegister\ViewUsers.aspx.vb Line: 85
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] AssetRegister.ViewUser.lstUsers_SelectedIndexChang ed (Object sender, EventArgs e) in C:\Dev\Asset Register SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset Register\AssetRegister\ViewUsers.aspx.vb:85
System.Web.UI.WebControls.ListControl.OnSelectedI ndexChang ed(EventArgs e)
System.Web.UI.WebControls.ListBox.System.Web.UI.I PostBackD ataHandler.RaisePostDataChangedEvent() System.Web.UI.Page.RaiseChangedEvents() System.Web.UI.Page.ProcessRequestMain()
.
.
Is the ListBox's AutoPostBack property set to True?
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer http://www.takempis.com
The more I learn, the less I know.
"yop" <yo*@oceanfree.net> wrote in message
news:04****************************@phx.gbl... Kevin
I have an item selected alright, daft idea but could it be something to do with postback or something?
I click on the item and call the following:
Private Sub lstUsers_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles lstUsers.SelectedIndexChanged
'Need to bind the textboxes from the choice picked out from the list UserName.Text = lstUsers.SelectedItem.Text
thanks
-----Original Message----- Unless an Item has been selected, this value will be null. -- HTH,
Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com The more I learn, the less I know.
"yop" <yo*@oceanfree.net> wrote in message news:0a****************************@phx.gbl... All
When I try to get the text from my listbox I am get an error which is listed below.
Any ideas?
Thanks
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:
Line 83: 'Need to bind the textboxes from the choice picked out from the list Line 84: ' Dim ListItem As ListItem = lstUsers.SelectedItem Line 85: UserName.Text = stUsers.SelectedItem.Text Line 86: Line 87: 'Get the user details and fill textboxes Source File: C:\Dev\Asset Register SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset Register\AssetRegister\ViewUsers.aspx.vb Line: 85
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] AssetRegister.ViewUser.lstUsers_SelectedIndexChang ed (Object sender, EventArgs e) in C:\Dev\Asset Register SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset Register\AssetRegister\ViewUsers.aspx.vb:85
System.Web.UI.WebControls.ListControl.OnSelectedIn dexChang ed(EventArgs e)
System.Web.UI.WebControls.ListBox.System.Web.UI.IP ostBackD ataHandler.RaisePostDataChangedEvent() System.Web.UI.Page.RaiseChangedEvents() System.Web.UI.Page.ProcessRequestMain()
.
Another possiblity: Is the ListBox dynamically added to the Page?
--
HTH,
Kevin Spencer
Microsoft MVP
..Net Developer http://www.takempis.com
The more I learn, the less I know.
"yop" <yo*@oceanfree.net> wrote in message
news:04****************************@phx.gbl... Kevin
I have an item selected alright, daft idea but could it be something to do with postback or something?
I click on the item and call the following:
Private Sub lstUsers_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) _ Handles lstUsers.SelectedIndexChanged
'Need to bind the textboxes from the choice picked out from the list UserName.Text = lstUsers.SelectedItem.Text
thanks
-----Original Message----- Unless an Item has been selected, this value will be null. -- HTH,
Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com The more I learn, the less I know.
"yop" <yo*@oceanfree.net> wrote in message news:0a****************************@phx.gbl... All
When I try to get the text from my listbox I am get an error which is listed below.
Any ideas?
Thanks
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:
Line 83: 'Need to bind the textboxes from the choice picked out from the list Line 84: ' Dim ListItem As ListItem = lstUsers.SelectedItem Line 85: UserName.Text = stUsers.SelectedItem.Text Line 86: Line 87: 'Get the user details and fill textboxes Source File: C:\Dev\Asset Register SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset Register\AssetRegister\ViewUsers.aspx.vb Line: 85
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] AssetRegister.ViewUser.lstUsers_SelectedIndexChang ed (Object sender, EventArgs e) in C:\Dev\Asset Register SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset Register\AssetRegister\ViewUsers.aspx.vb:85
System.Web.UI.WebControls.ListControl.OnSelectedIn dexChang ed(EventArgs e)
System.Web.UI.WebControls.ListBox.System.Web.UI.IP ostBackD ataHandler.RaisePostDataChangedEvent() System.Web.UI.Page.RaiseChangedEvents() System.Web.UI.Page.ProcessRequestMain()
.
Yes it is a property. Here is the code that works fine on
my machine.....
Code behind >>>>>
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs)
Handles ListBox1.SelectedIndexChanged
TextBox1.Text = ListBox1.SelectedValue()
End Sub
ASPX code >>>>>
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft
Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="Visual
Basic .NET 7.1">
<meta name="vs_defaultClientScript"
content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post"
runat="server">
<asp:ListBox id="ListBox1"
style="Z-INDEX: 101; LEFT: 288px; POSITION: absolute; TOP:
168px"
runat="server"
Width="160px" Height="168px" AutoPostBack="True">
<asp:ListItem
Value="Tapasvi">Tapasvi</asp:ListItem>
<asp:ListItem Value="Tap
at Work">Tap at Work</asp:ListItem>
</asp:ListBox>
<asp:TextBox id="TextBox1"
style="Z-INDEX: 102; LEFT: 288px; POSITION: absolute; TOP:
120px"
runat="server"></asp:TextBox>
</form>
</body>
</HTML>
Thanks,
Tap -----Original Message----- Aye it is set alright.
The SelectedValue is not a property of the listbox?
-----Original Message----- Is the ListBox's AutoPostBack property set to True?
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com The more I learn, the less I know.
"yop" <yo*@oceanfree.net> wrote in message news:04****************************@phx.gbl... Kevin
I have an item selected alright, daft idea but could it be something to do with postback or something?
I click on the item and call the following:
Private Sub lstUsers_SelectedIndexChanged(ByVal senderAs Object, ByVal e As System.EventArgs) _ HandleslstUsers.SelectedIndexChanged 'Need to bind the textboxes from the choice picked out from the list UserName.Text = lstUsers.SelectedItem.Text
thanks
>-----Original Message----- >Unless an Item has been selected, this value will be null. > >-- >HTH, > >Kevin Spencer >Microsoft MVP >..Net Developer >http://www.takempis.com >The more I learn, the less I know. > >"yop" <yo*@oceanfree.net> wrote in message >news:0a****************************@phx.gbl... >> All >> >> When I try to get the text from my listbox I am getan >> error which is listed below. >> >> Any ideas? >> >> Thanks >> >> Object reference not set to an instance of anobject. >> Description: An unhandled exception occurred duringthe >> execution of the current web request. Please reviewthe >> 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: >> >> >> Line 83: 'Need to bind the textboxes fromthe >> choice picked out from the list >> Line 84: ' Dim ListItem As ListItem = >> lstUsers.SelectedItem >> Line 85: UserName.Text = stUsers.SelectedItem.Text >> Line 86: >> Line 87: 'Get the user details and fill textboxes >> >> Source File: C:\Dev\Asset Register >> SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset >> Register\AssetRegister\ViewUsers.aspx.vb Line: 85 >> >> Stack Trace: >> >> >> [NullReferenceException: Object reference not setto an >> instance of an object.] >>AssetRegister.ViewUser.lstUsers_SelectedIndexChan ged >> (Object sender, EventArgs e) in C:\Dev\AssetRegister >> SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset >> Register\AssetRegister\ViewUsers.aspx.vb:85 >> >> System.Web.UI.WebControls.ListControl.OnSelectedI ndexChang >> ed(EventArgs e) >> >> System.Web.UI.WebControls.ListBox.System.Web.UI.I PostBackD >> ataHandler.RaisePostDataChangedEvent() >> System.Web.UI.Page.RaiseChangedEvents() >> System.Web.UI.Page.ProcessRequestMain() >> >> >> >> >> > > >. >
. .
No the listbox is added at design time but the items are
added from the DB at run time. Maybe that is an issue.
Extremely frustating!! :(
Also the selectedvalue property is telling it is "not a
member of System.Web.UI.WebControls.Listbox.
I am using Framework 1.1, there is an issue with using
the webcontrols and this version I think??
Would I be better of using a 3rd party list or data list
or something? -----Original Message----- Yes it is a property. Here is the code that works fine
onmy machine.....
Code behind >>>>>
Private Sub ListBox1_SelectedIndexChanged(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged TextBox1.Text = ListBox1.SelectedValue() End Sub
ASPX code >>>>>
<HTML> <HEAD> <title>WebForm1</title> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE"
content="VisualBasic .NET 7.1"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <asp:ListBox id="ListBox1" style="Z-INDEX: 101; LEFT: 288px; POSITION: absolute;
TOP:168px" runat="server" Width="160px" Height="168px" AutoPostBack="True"> <asp:ListItem Value="Tapasvi">Tapasvi</asp:ListItem> <asp:ListItem Value="Tap at Work">Tap at Work</asp:ListItem> </asp:ListBox> <asp:TextBox id="TextBox1" style="Z-INDEX: 102; LEFT: 288px; POSITION: absolute;
TOP:120px"
runat="server"></asp:TextBox> </form> </body> </HTML>
Thanks,
Tap
-----Original Message----- Aye it is set alright.
The SelectedValue is not a property of the listbox?
-----Original Message----- Is the ListBox's AutoPostBack property set to True?
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com The more I learn, the less I know.
"yop" <yo*@oceanfree.net> wrote in message news:04****************************@phx.gbl.. . Kevin
I have an item selected alright, daft idea but could
it be something to do with postback or something?
I click on the item and call the following:
Private Sub lstUsers_SelectedIndexChanged(ByVal
senderAs Object, ByVal e As System.EventArgs) _ Handles lstUsers.SelectedIndexChanged 'Need to bind the textboxes from the choice picked
out from the list UserName.Text = lstUsers.SelectedItem.Text
thanks
>-----Original Message----- >Unless an Item has been selected, this value will be null. > >-- >HTH, > >Kevin Spencer >Microsoft MVP >..Net Developer >http://www.takempis.com >The more I learn, the less I know. > >"yop" <yo*@oceanfree.net> wrote in message >news:0a****************************@phx.gbl... >> All >> >> When I try to get the text from my listbox I am
getan >> error which is listed below. >> >> Any ideas? >> >> Thanks >> >> Object reference not set to an instance of an object. >> Description: An unhandled exception occurred
duringthe >> execution of the current web request. Please
reviewthe >> 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: >> >> >> Line 83: 'Need to bind the textboxes from the >> choice picked out from the list >> Line 84: ' Dim ListItem As ListItem = >> lstUsers.SelectedItem >> Line 85: UserName.Text = stUsers.SelectedItem.Text >> Line 86: >> Line 87: 'Get the user details and fill textboxes >> >> Source File: C:\Dev\Asset Register >> SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset >> Register\AssetRegister\ViewUsers.aspx.vb Line:
85 >> >> Stack Trace: >> >> >> [NullReferenceException: Object reference not set to an >> instance of an object.] >> AssetRegister.ViewUser.lstUsers_SelectedIndexCha nged >> (Object sender, EventArgs e) in C:\Dev\Asset Register >> SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset >> Register\AssetRegister\ViewUsers.aspx.vb:85 >> >> System.Web.UI.WebControls.ListControl.OnSelected IndexCha
ng >> ed(EventArgs e) >> >> System.Web.UI.WebControls.ListBox.System.Web.UI. IPostBac
kD >> ataHandler.RaisePostDataChangedEvent() >> System.Web.UI.Page.RaiseChangedEvents() >> System.Web.UI.Page.ProcessRequestMain() >> >> >> >> >> > > >. >
. . .
No the listbox is added at design time but the items are
added from the DB at run time. Maybe that is an issue.
Extremely frustating!! :(
Also the selectedvalue property is telling it is "not a
member of System.Web.UI.WebControls.Listbox.
I am using Framework 1.1, there is an issue with using
the webcontrols and this version I think??
Would I be better of using a 3rd party list or data list
or something? -----Original Message----- Yes it is a property. Here is the code that works fine
onmy machine.....
Code behind >>>>>
Private Sub ListBox1_SelectedIndexChanged(ByVal sender
As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged TextBox1.Text = ListBox1.SelectedValue() End Sub
ASPX code >>>>>
<HTML> <HEAD> <title>WebForm1</title> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name="CODE_LANGUAGE"
content="VisualBasic .NET 7.1"> <meta name="vs_defaultClientScript" content="JavaScript"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> </HEAD> <body MS_POSITIONING="GridLayout"> <form id="Form1" method="post" runat="server"> <asp:ListBox id="ListBox1" style="Z-INDEX: 101; LEFT: 288px; POSITION: absolute;
TOP:168px" runat="server" Width="160px" Height="168px" AutoPostBack="True"> <asp:ListItem Value="Tapasvi">Tapasvi</asp:ListItem> <asp:ListItem Value="Tap at Work">Tap at Work</asp:ListItem> </asp:ListBox> <asp:TextBox id="TextBox1" style="Z-INDEX: 102; LEFT: 288px; POSITION: absolute;
TOP:120px"
runat="server"></asp:TextBox> </form> </body> </HTML>
Thanks,
Tap
-----Original Message----- Aye it is set alright.
The SelectedValue is not a property of the listbox?
-----Original Message----- Is the ListBox's AutoPostBack property set to True?
-- HTH,
Kevin Spencer Microsoft MVP ..Net Developer http://www.takempis.com The more I learn, the less I know.
"yop" <yo*@oceanfree.net> wrote in message news:04****************************@phx.gbl.. . Kevin
I have an item selected alright, daft idea but could
it be something to do with postback or something?
I click on the item and call the following:
Private Sub lstUsers_SelectedIndexChanged(ByVal
senderAs Object, ByVal e As System.EventArgs) _ Handles lstUsers.SelectedIndexChanged 'Need to bind the textboxes from the choice picked
out from the list UserName.Text = lstUsers.SelectedItem.Text
thanks
>-----Original Message----- >Unless an Item has been selected, this value will be null. > >-- >HTH, > >Kevin Spencer >Microsoft MVP >..Net Developer >http://www.takempis.com >The more I learn, the less I know. > >"yop" <yo*@oceanfree.net> wrote in message >news:0a****************************@phx.gbl... >> All >> >> When I try to get the text from my listbox I am
getan >> error which is listed below. >> >> Any ideas? >> >> Thanks >> >> Object reference not set to an instance of an object. >> Description: An unhandled exception occurred
duringthe >> execution of the current web request. Please
reviewthe >> 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: >> >> >> Line 83: 'Need to bind the textboxes from the >> choice picked out from the list >> Line 84: ' Dim ListItem As ListItem = >> lstUsers.SelectedItem >> Line 85: UserName.Text = stUsers.SelectedItem.Text >> Line 86: >> Line 87: 'Get the user details and fill textboxes >> >> Source File: C:\Dev\Asset Register >> SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset >> Register\AssetRegister\ViewUsers.aspx.vb Line:
85 >> >> Stack Trace: >> >> >> [NullReferenceException: Object reference not set to an >> instance of an object.] >> AssetRegister.ViewUser.lstUsers_SelectedIndexCha nged >> (Object sender, EventArgs e) in C:\Dev\Asset Register >> SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset >> Register\AssetRegister\ViewUsers.aspx.vb:85 >> >> System.Web.UI.WebControls.ListControl.OnSelected IndexCha
ng >> ed(EventArgs e) >> >> System.Web.UI.WebControls.ListBox.System.Web.UI. IPostBac
kD >> ataHandler.RaisePostDataChangedEvent() >> System.Web.UI.Page.RaiseChangedEvents() >> System.Web.UI.Page.ProcessRequestMain() >> >> >> >> >> > > >. >
. . .
eventually found the fix after trawling the forums!!
"I was loading the listbox dynamically on the page_load
event.
Eventually I discovered - that was too late,
The items showed on the page but weren't really
there..... (figure that one
out)
When I moved the list populate routine to the page_init
event everything
worked great."
Thanks for all your help -----Original Message----- All
When I try to get the text from my listbox I am get an error which is listed below.
Any ideas?
Thanks
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:
Line 83: 'Need to bind the textboxes from the choice picked out from the list Line 84: ' Dim ListItem As ListItem = lstUsers.SelectedItem Line 85: UserName.Text =
stUsers.SelectedItem.TextLine 86: Line 87: 'Get the user details and fill textboxes
Source File: C:\Dev\Asset Register SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset Register\AssetRegister\ViewUsers.aspx.vb Line: 85
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] AssetRegister.ViewUser.lstUsers_SelectedIndexChang ed (Object sender, EventArgs e) in C:\Dev\Asset Register SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset Register\AssetRegister\ViewUsers.aspx.vb:85
System.Web.UI.WebControls.ListControl.OnSelectedI ndexChan
ged(EventArgs e)
System.Web.UI.WebControls.ListBox.System.Web.UI.I PostBack
DataHandler.RaisePostDataChangedEvent() System.Web.UI.Page.RaiseChangedEvents() System.Web.UI.Page.ProcessRequestMain()
.
eventually found the fix after trawling the forums!!
"I was loading the listbox dynamically on the page_load
event.
Eventually I discovered - that was too late,
The items showed on the page but weren't really
there..... (figure that one
out)
When I moved the list populate routine to the page_init
event everything
worked great."
Thanks for all your help -----Original Message----- All
When I try to get the text from my listbox I am get an error which is listed below.
Any ideas?
Thanks
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:
Line 83: 'Need to bind the textboxes from the choice picked out from the list Line 84: ' Dim ListItem As ListItem = lstUsers.SelectedItem Line 85: UserName.Text =
stUsers.SelectedItem.TextLine 86: Line 87: 'Get the user details and fill textboxes
Source File: C:\Dev\Asset Register SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset Register\AssetRegister\ViewUsers.aspx.vb Line: 85
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.] AssetRegister.ViewUser.lstUsers_SelectedIndexChang ed (Object sender, EventArgs e) in C:\Dev\Asset Register SW\SourceCode\DotNet\ASP.NET\ASP.NET Asset Register\AssetRegister\ViewUsers.aspx.vb:85
System.Web.UI.WebControls.ListControl.OnSelectedI ndexChan
ged(EventArgs e)
System.Web.UI.WebControls.ListBox.System.Web.UI.I PostBack
DataHandler.RaisePostDataChangedEvent() System.Web.UI.Page.RaiseChangedEvents() System.Web.UI.Page.ProcessRequestMain()
. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Ben |
last post by:
Hi,
I seem to be having a memory management issue with the ListBox control.
Using .NET Memory Profiler, the Clear() method does not appear to...
|
by: jarit |
last post by:
Hi,
Found these coding guidelines for C#, HTML, Javascript, Java, HTML,
PL/SQL, T-SQL, VB and VBScript.
Well written and free to download.
...
|
by: Chris Leuty |
last post by:
I am populating a multiselect Listbox from a dataset, with the content of
the listbox filled by one table, and the selections determined from...
|
by: Sachin Kuchinad |
last post by:
Hi All
I am using .NET Framework version 1.0.3705 to build a website.
Now i have made a webform and on that i have added a dropdown to the page
...
|
by: tangokilo |
last post by:
Hello and thanks for your help,
I have the following Listbox created in VisualStudio 2003 designer, desiring
to select multiple entries from that...
|
by: Brent |
last post by:
I'm trying to open and manipulate an Excel spreadsheet from C#. To that
end, I've referenced Interop.EXCEL9.dll, which I have on my machine. All
of...
|
by: Pat |
last post by:
I'm a newbie to c# and could use some help - been banging my head on
the keyboard for 3 days now.
I have an unbound listbox that I'm populating...
|
by: rn5a |
last post by:
I have a ListBox which should list all the files & directories that
exist in a particular directory. The problem is I can get the ListBox
to list...
|
by: John |
last post by:
Using Access 2007 I find that, on opening a form, a listbox control
always displays one of the values in the list, even if no value has
been...
|
by: tammygombez |
last post by:
Hey fellow JavaFX developers,
I'm currently working on a project that involves using a ComboBox in JavaFX, and I've run into a bit of an issue....
|
by: better678 |
last post by:
Question:
Discuss your understanding of the Java platform. Is the statement "Java is interpreted" correct?
Answer:
Java is an object-oriented...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: CD Tom |
last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
|
by: Naresh1 |
last post by:
What is WebLogic Admin Training?
WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function.
Here is my code.
...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: AndyPSV |
last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
| |