473,320 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,320 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 1443
> 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
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.