472,982 Members | 2,320 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,982 software developers and data experts.

Urgent: Please need help badly

hi all

I am facing a little problem. I have a form with a dropdownlist control. I have a button and when i click the form posts back
The problem is that in the on button click event i'm calling this metho
------------------
Sub cute(sender As Object, e As EventArgs
Response.Write(ddlColors.SelectedItem.text
End Su

------------------
in which i'm only trying to access my dropdownlist ddlColors's selected value. It gives me this exception
---------------------------------------------------------------------------------------------
System.NullReferenceException: Object reference not set to an instance of an objec
---------------------------------------------------------------------------------------------

Please tell me what can i do about this and what am i doing wrong

thanks!
Nov 18 '05 #1
3 1218
Hi, Bilal,

Try to debug your code to see what is in fact null-reference (Nothing in
VB.NET).

Greetings
Martin
"Bilal" <bs*****@apparelco.com> wrote in message
news:09**********************************@microsof t.com...
hi all,

I am facing a little problem. I have a form with a dropdownlist control. I have a button and when i click the form posts back. The problem is that in the on button click event i'm calling this method
-------------------
Sub cute(sender As Object, e As EventArgs)
Response.Write(ddlColors.SelectedItem.text)
End Sub

-------------------
in which i'm only trying to access my dropdownlist ddlColors's selected value. It gives me this exception: -------------------------------------------------------------------------- -------------------- System.NullReferenceException: Object reference not set to an instance of an object -------------------------------------------------------------------------- --------------------
Please tell me what can i do about this and what am i doing wrong.

thanks!

Nov 18 '05 #2
Kindly send the code:
so that it can be debugged.
As if there is any value in the dropdownlist and if u are calling the
function at the click of the button then it should work.
Arvind.
"Martin Dechev" <de*******@hotmail.com> wrote in message
news:e2*************@TK2MSFTNGP11.phx.gbl...
Hi, Bilal,

Try to debug your code to see what is in fact null-reference (Nothing in
VB.NET).

Greetings
Martin
"Bilal" <bs*****@apparelco.com> wrote in message
news:09**********************************@microsof t.com...
hi all,

I am facing a little problem. I have a form with a dropdownlist control.
I have a button and when i click the form posts back.
The problem is that in the on button click event i'm calling this method
-------------------
Sub cute(sender As Object, e As EventArgs)
Response.Write(ddlColors.SelectedItem.text)
End Sub

-------------------
in which i'm only trying to access my dropdownlist ddlColors's selected value. It gives me this exception:

--------------------------------------------------------------------------
--------------------
System.NullReferenceException: Object reference not set to an instance

of an object

--------------------------------------------------------------------------
--------------------

Please tell me what can i do about this and what am i doing wrong.

thanks!


Nov 18 '05 #3
hey Arvind
thanks for your reply. i figured that out by moving my code where i populated the dropdownlist into the sub page_load and there it works fine. I am really a new bie at .net and am trying to move to vs.net from visual interdev

I have one another problem which i encounter when i create a new file in vs.net. I am pasting the error. Basically I have a file named ShoppingCart.aspx which when i build and browse gives the error below
Please help me
---------------------------------------------------
Server Error in '/OnLineShopping' Application
-------------------------------------------------------------------------------

Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: Could not load type 'OnLineShopping.ShoppingCart'

Source Error:

Line 1: <%@ Page Language="vb" AutoEventWireup="false" Codebehind="ShoppingCart.aspx.vb" Inherits="OnLineShopping.ShoppingCart"%
Line 2: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
Line 3: <html
Source File: C:\Inetpub\wwwroot\OnLineShopping\ShoppingCart.asp x Line: 1

-------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
---------------------------------------------------
----- Arvind P Rangan wrote: ----

Kindly send the code
so that it can be debugged
As if there is any value in the dropdownlist and if u are calling th
function at the click of the button then it should work
Arvind
"Martin Dechev" <de*******@hotmail.com> wrote in messag
news:e2*************@TK2MSFTNGP11.phx.gbl..
Hi, Bilal
Try to debug your code to see what is in fact null-reference (Nothing i VB.NET)
Greeting

Marti
"Bilal" <bs*****@apparelco.com> wrote in messag
news:09**********************************@microsof t.com..
hi all
I am facing a little problem. I have a form with a dropdownlist control
have a button and when i click the form posts back
The problem is that in the on button click event i'm calling this metho
------------------
Sub cute(sender As Object, e As EventArgs
Response.Write(ddlColors.SelectedItem.text
End Su
------------------ in which i'm only trying to access my dropdownlist ddlColors's selecte

value. It gives me this exception
-------------------------------------------------------------------------

-------------------
System.NullReferenceException: Object reference not set to an instanc

o an objec
-------------------------------------------------------------------------

------------------- Please tell me what can i do about this and what am i doing wrong
thanks

Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Christopher Benson-Manica | last post by:
Is there anything that one can do to a std::ostringstream that would make its destructor explode? I'm basically doing { std::ostringstream ss, msg; // do BUNCHES of stuff with ss and msg ...
0
by: Amjath | last post by:
I put all my application updater block dll to GAC, to avoid keeping this dll's in my bin folder. After doing this all i build my project, it works fine, now i run my project it give me an error...
13
by: Gohar | last post by:
Any one please send me the C++ code for arithmatic calculator using linked lists Which performs addition ,subtraction,multiplication,division and modulus(using operator overloading). i need it...
7
by: Gohar | last post by:
Any one can send me the C++ code for arithmatic calculator using linked list(with operator overloading. not necessarily). which performs Addition, subtraction ,multiplication,division,modulus. i...
2
by: cryon.b | last post by:
Hi To All, I took up the IBM sample testfor Exam 700 today and I have the test tomorrow,I have some questions for which Iam not sure about the right answer,can anyone please guide me as to what is...
0
by: dinoo | last post by:
I did not find the right forum to post this issue, please excuse me for this. But I need the help here very badly. I am having a Windows Service in .NET which is accessing a MDB file which is...
3
by: araunity2005 | last post by:
I badly need help in makinga program to the following solution and I have no idea how to do it.Can someone please help me. The link is to the content which was given for practise before exams, It is...
77
by: Hans Schneider | last post by:
1. in the prg bellow what vars are stored on stack, heap, data segment? int i; void main() { int j; int *k = (void *)malloc(1); }
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.