473,657 Members | 2,411 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

why System.Argument NullException'

Greetings, experts!

I'm having a bit of a problem importing some working code from last
night into Visual Studio. The code compiles correctly, but when I run
the program, it doesn't seem to open the text window to ask for input.
It simply errors on the ReadLine statement. (See the attached code.)

When I use "Start Without Debugging", I received an exception window
that says "An exception 'System.Argumen tNullException' has occurred in
CSharp2.exe". It then gives me the option to debug. ("Do you want to
debug using the selected debugger?") When I press the "Yes" button, the
program shows the error on the line "double radius = double.Parse
(Console.ReadLi ne());"

I speculate that this is some configuration problem with my local
environment, but (after much searching) I can't find any.

Do you have any ideas on this one?

Thank you!

Dave

here's the source-code:

using System;

namespace CSharp2 {
public class GetArea {
static void Main(string[] args) {
Console.Write(" Radius: ");
double radius = double.Parse(Co nsole.ReadLine( ));
while (radius != 0) {
double area = radius * Math.PI;
Console.WriteLi ne("With radius = " + radius + ", Area =
" + area);
Console.Write(" Radius: ");
radius = double.Parse(Co nsole.ReadLine( ));
} // while (radius != 0)
} // static void Main
} // public class GetArea
} //namespace CSharp2

Nov 17 '05 #1
3 4221
Hello

If you are trying to import some code from the last NIGHT, then may be you
just missed the "Output Type" property of your project ? Try to check that
it is set to "Console Application". Because the described error is a symptom
of "Window Application" set in output type.


--
With best regards,
Andrew

http://www.codeproject.com/script/pr...asp?id=1181072
"davesNotHe re" <me@here.org> wrote in message
news:MP******** *************** *@news.verizon. net...
Greetings, experts!

I'm having a bit of a problem importing some working code from last
night into Visual Studio. The code compiles correctly, but when I run
the program, it doesn't seem to open the text window to ask for input.
It simply errors on the ReadLine statement. (See the attached code.)

When I use "Start Without Debugging", I received an exception window
that says "An exception 'System.Argumen tNullException' has occurred in
CSharp2.exe". It then gives me the option to debug. ("Do you want to
debug using the selected debugger?") When I press the "Yes" button, the
program shows the error on the line "double radius = double.Parse
(Console.ReadLi ne());"

I speculate that this is some configuration problem with my local
environment, but (after much searching) I can't find any.

Do you have any ideas on this one?

Thank you!

Dave

here's the source-code:

using System;

namespace CSharp2 {
public class GetArea {
static void Main(string[] args) {
Console.Write(" Radius: ");
double radius = double.Parse(Co nsole.ReadLine( ));
while (radius != 0) {
double area = radius * Math.PI;
Console.WriteLi ne("With radius = " + radius + ", Area =
" + area);
Console.Write(" Radius: ");
radius = double.Parse(Co nsole.ReadLine( ));
} // while (radius != 0)
} // static void Main
} // public class GetArea
} //namespace CSharp2

Nov 17 '05 #2
i am not sur if the problem is the output type. I think you are getting a
null value from the console.

try using

string s = Console.ReadLin e();

if(s.TrimEnd(nu ll) && s.Length > 0)
try
{
Double p = double.Parse(s) ;
}
catch(Exception e)
{

}
"davesNotHe re" <me@here.org> wrote in message
news:MP******** *************** *@news.verizon. net...
Greetings, experts!

I'm having a bit of a problem importing some working code from last
night into Visual Studio. The code compiles correctly, but when I run
the program, it doesn't seem to open the text window to ask for input.
It simply errors on the ReadLine statement. (See the attached code.)

When I use "Start Without Debugging", I received an exception window
that says "An exception 'System.Argumen tNullException' has occurred in
CSharp2.exe". It then gives me the option to debug. ("Do you want to
debug using the selected debugger?") When I press the "Yes" button, the
program shows the error on the line "double radius = double.Parse
(Console.ReadLi ne());"

I speculate that this is some configuration problem with my local
environment, but (after much searching) I can't find any.

Do you have any ideas on this one?

Thank you!

Dave

here's the source-code:

using System;

namespace CSharp2 {
public class GetArea {
static void Main(string[] args) {
Console.Write(" Radius: ");
double radius = double.Parse(Co nsole.ReadLine( ));
while (radius != 0) {
double area = radius * Math.PI;
Console.WriteLi ne("With radius = " + radius + ", Area =
" + area);
Console.Write(" Radius: ");
radius = double.Parse(Co nsole.ReadLine( ));
} // while (radius != 0)
} // static void Main
} // public class GetArea
} //namespace CSharp2

Nov 17 '05 #3
In article <#n************ *@tk2msftngp13. phx.gbl>,
an************* @gmail.com says...
Hello

If you are trying to import some code from the last NIGHT, then may be you
just missed the "Output Type" property of your project ? Try to check that
it is set to "Console Application". Because the described error is a symptom
of "Window Application" set in output type.


Thank you, my friend. That did it.

Best Regards,
Dave
Nov 17 '05 #4

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

Similar topics

3
15296
by: MJB | last post by:
I'm getting an IStream back from function xmlHttp.responsestream. I would like to convert this to a System.IO.Stream in order to work with it in my application. Has anyone encountered this and written a conversion? TIA, Matt
3
4364
by: Bisbal | last post by:
Hi, I'd like to know if it is possible to create a form type from a string. My case: I have a DataTable with forms names (i.e frm_001_UserInfo.cs), and I'd like to create an instance of that form from my code dynamically, retrieving the form name from the database. Something like str = "frm_001_UserInfo.cs" and then create an instance of the form using str.
0
1314
by: Joachim | last post by:
When trying to connect clientSocket.Connect(new IPEndPoint(new IPAddress(ipOctets), port)); I get a System.ArgumentException (not a ArgumentNullException) saying "address". What is wrong? I have checked the contents of ipOctects and it is 127 0 0 1
5
4360
by: hzgt9b | last post by:
I'm building a dataset that writes out a Point type value. Here's the code that I've got: 1 Dim dsContent As DataSet = New DataSet("content") 2 Dim dtAsset As DataTable = New DataTable("asset") 3 Dim dcPk(0) As DataColumn 4 dcPk(0) = _ 5 dtAsset.Columns.Add("fullName", Type.GetType("System.String")) 6 dtAsset.Columns.Add("videoLocation", Type.GetType("System.Drawing.Point"))
1
11036
by: florinake | last post by:
The following error occurs when I want to make a relation between two tables : "System.ArgumentNullException: 'column' argument cannot be null" . The code where appears the exception: ds.Relations.Add("ProjectToTestcase", _ ds.Tables("projects").Columns("projectID"), _ ds.Tables("testcasesnames").Columns("projectID")) The name of the columns from the code is the same with the names of the columns from DB.
2
3214
by: Claire | last post by:
I'm a noob at emailing from code and I need to add email capabilities to my application. The following code completes without exceptions but I'm not receiving any test emails. How do you debug this? Ive checked my bad mail folder, and other IIS similar folders and they're empty. Can the mail classes be used without having a SMTP server running on localhost? Can you use any smtp server that's capable of being set up from a PC, e.g. an ISP...
0
9828
by: pankajprakash | last post by:
Hi all I am using the Ajax control toolkit and want to the fill the gridview but at the time of rendering it occurs the error "Sys.ArgumentNullException: Value cannot be null. Parameter name: element". Here am posting the whole .ascx page. Will you please let me know how can i remove this error.
2
2494
by: Tom C | last post by:
This error occurs erratically at startup. It appears to be all native code. Does anyone have any idea what the heck could be cauing this? System.ArgumentNullException: Value cannot be null. Parameter name: pen at System.Drawing.Graphics.DrawLine(Pen pen, Int32 x1, Int32 y1, Int32 x2, Int32 y2) at dh.OnPaint(PaintEventArgs e) at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e,
5
8312
by: Henry Stock | last post by:
I am trying to understand the following error: Any thing you can tell me about this is appreciated. Security Exception Description: The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. Exception Details: for the permission of type
0
8312
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8606
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1622
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.