473,396 Members | 1,724 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

command window / immed window

hi
i have this piece of code but it never shows the ex.tostring in the command
or immed window.
how do i see it?

this is in a class

public void getTeachers()
{
try
{
PermTeacher p =new PermTeacher ();
p.name = "teacher1";
arrTeachers.Add (p);
if (arrTeachers !=null)
Console.WriteLine(this.arrTeachers.Count); //how can i see this?
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
}
Nov 16 '05 #1
5 1446
> public void getTeachers()
{
try
{
PermTeacher p =new PermTeacher ();
p.name = "teacher1";
arrTeachers.Add (p);
if (arrTeachers !=null)
Console.WriteLine(this.arrTeachers.Count); //how can i see this?
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
}


That's strange, did you figure out what is going on ?

Gawel
Nov 16 '05 #2
Not 100% sure if I understand you. But isn't Console.... supposed to write
out to the console? Try Debug.WriteLine (Diagnostics namespace) to write to
the other windows

Yves

"juzan" <ch***@hotmail.com> schreef in bericht
news:ur**************@TK2MSFTNGP09.phx.gbl...
hi
i have this piece of code but it never shows the ex.tostring in the command or immed window.
how do i see it?

this is in a class

public void getTeachers()
{
try
{
PermTeacher p =new PermTeacher ();
p.name = "teacher1";
arrTeachers.Add (p);
if (arrTeachers !=null)
Console.WriteLine(this.arrTeachers.Count); //how can i see this?
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
}

Nov 16 '05 #3
> Not 100% sure if I understand you. But isn't Console.... supposed to write
out to the console?


I am using Console.WriteLine all the time and I have no problem.

Gawel
Nov 16 '05 #4
Hi Juzan,

The console output is directed to the 'Output' window (CTRL+ALT+A) in the
IDE and not the command or immediate windows.

Gary

"juzan" <ch***@hotmail.com> wrote in message
news:ur**************@TK2MSFTNGP09.phx.gbl...
hi
i have this piece of code but it never shows the ex.tostring in the command or immed window.
how do i see it?

this is in a class

public void getTeachers()
{
try
{
PermTeacher p =new PermTeacher ();
p.name = "teacher1";
arrTeachers.Add (p);
if (arrTeachers !=null)
Console.WriteLine(this.arrTeachers.Count); //how can i see this?
}
catch(Exception ex)
{
Console.WriteLine(ex.ToString());
}
}

Nov 16 '05 #5
Clever answers do not seem to work, let's try the primitive ones. It's some
second week I am learning C#, so correct me, if I am wrong.

1) Is "this.arrTeachers.Count" actually a string? I bet, it is not.
Then it needs formatting like
Console.WriteLine("{0}",this.arrTeachers.Count);

2) As for ex.ToString, it is not going to be shown unless you introduce some
problem into "try" block. I bet you know that, don't you?

==============
BTW when I try to understand the logic of your checking that arrTeachers is
not null , I feel dizzy :-)

Suppose, arrTeachers really happens to be null. Then, the exception is
thrown at the point, where you tried to do the addition ("arrTeachers.Add
(p);"), because u cannot insert something into nothing ;-)

So, if arrTeachers is null, you NEVER reach the "if" statement to see if
arrTeachers is null.

So you check if arrTeachers is not null only in the case when arrTeachers is
definitely not null... %)


Hello, juzan!
You wrote on Sun, 4 Apr 2004 13:17:58 +1000:

j> hi i have this piece of code but it never shows the ex.tostring in
j> the command or immed window.
j> how do i see it?

j> this is in a class

j> public void getTeachers()
j> {
j> try {
j> PermTeacher p =new PermTeacher ();
j> p.name = "teacher1";
j> arrTeachers.Add (p);
j> if (arrTeachers !=null)
j> Console.WriteLine(this.arrTeachers.Count); //how can i see this?
j> }
j> catch(Exception ex)
j> {
j> Console.WriteLine(ex.ToString());
j> }
j> }
With best regards, Kozynenko Ganna. E-mail: gk**@isd.dp.ua
Nov 16 '05 #6

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

Similar topics

0
by: Tom Dacon | last post by:
"Open .Net Command Window Here" context menu for Windows Explorer: The reg file described below adds a new menu item to Windows Explorer's context menu when you right-click over a folder (or the...
4
by: juzan | last post by:
hi i have this piece of code but it never shows the ex.tostring in the command or immed window. how do i see it? this is in a class public void getTeachers() { try
2
by: hleewood | last post by:
I'm using VS 2003, VB.Net. For no apparent reason the Command Window no longer functions. It doesn't auto-complete and doesn't recognize any syntax.
2
by: frazer | last post by:
hi sometimes when i execute some commands in the immed window, it says, identifier out of scope. what am i doing wrong. eg n1.Security.SecurityAccessRights.None security is a class in...
4
by: Flip | last post by:
When I'm trying to debug an app in VS, I'm trying to get the value of a variable by typing out a question mark and then the variable name. But when I do that I get an error from the Output Window....
3
by: Chris Lane | last post by:
Hi, Stupid question here but I get the following error when debugging: 'debug.writeline' is not declared or the module containing it is not loaded in the debugging session. I can however use...
2
by: raqib.rafique | last post by:
The immediate window in Vs.NET is giving me problems when i use it with C#. Simple example is I have the following line of code in a function String MyString = "abc.doc"; Then I put a...
1
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, i'm the immediate window debugging my javascript and got the following: ?list {...} list is an array, can someone please tell me what do i do with this? thanks, rodchar
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...

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.