PDA

View Full Version : why this error?


twocool
03-29-2003, 03:28 AM
hi. i am using two listboxes and movng data from one listbox to another. i am using the code below. i am able to do it successfully in one page.. but in an another i get an error saying "Object reference not set to an instance of an object" why is this so?


Private Sub Ebtn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Ebtn1.Click
EList2.Items.Add(EList1.SelectedItem)
EList1.Items.Remove(EList1.SelectedItem)
End Sub

Morgoth
03-29-2003, 10:12 PM
Looks to me like you're not sending all the information from your first page to your second page, when you added... Private Sub Ebtn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Ebtn1.Click
EList2.Items.Add(EList1.SelectedItem)
EList1.Items.Remove(EList1.SelectedItem)
End Sub to it...

whammy
03-31-2003, 04:07 AM
Please refrain from answering .NET questions if you aren't familiar with .NET, Morgoth (it's NOTHING like ASP, if you are thinking that).

I haven't messed with using client-side code generated by .NET (like combo boxes) along with posting a form to itself yet, and when I do it will use C#, instead of VB...

Can you give an example of the code for the page it works on, and the page it doesn't?

The answer should be determinable, then.

Morgoth
03-31-2003, 06:34 AM
Well, blah...
I didn't understand the question anyways!

Mhtml
03-31-2003, 01:11 PM
Originally posted by Morgoth
Well, blah...
I didn't understand the question anyways!

Roflmao ... lol :D

Whammy has a point though. ;)

Morgoth
03-31-2003, 08:45 PM
It's all VB to me!

whammy
04-01-2003, 12:01 AM
Actually, .NET has some similarities to VB (although VB.NET has added a LOT of functionality that didn't previously exist to try and bring it up to par with other languages)... especially if you're coding in VB.NET (which I'm usually not!, but of course Visual Studio .NET has a very similar interface, from the very little I've used VB in the past).

twocool
04-01-2003, 01:16 AM
hi maybe u guys wan to take a look at this link. http://aspnet101.com/aspnet101/aspnet/codesample.aspx?code=2Listboxes

i am basically trying to do this. that is to move the records from one listbox to another. i have used the same kind of code that i had in my first thread, in another page and it works fine. however when i try it on another page it does not work and it shows me that error. so i would like to know if anyone has any idea on why i am getting such errors and if i have made any mistakes. thankss.

twocool
04-02-2003, 06:33 AM
hope somebody can help. thanks

Roelf
04-02-2003, 08:28 AM
does it have to be .NET or even serverside?

http://www22.brinkster.com/rprakken/experiments/selects.html

twocool
04-04-2003, 07:31 AM
its has to be .net

twocool
04-07-2003, 10:45 AM
can someone pls advise me how to slove this error thank u