473,396 Members | 1,826 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.

Simple program not producing output

Hi.

I am trying to learn about array lists, and found an example on MSDN. I
tried to compile it but it's not producing any output. I can't see why.
Any ideas?

Here is what I did.

1. Started new windows application.
2. Deleted the code files (program.cs, form.cs)
3. Created a new code file.
4. Pasted the MSDN code into this code file.
5. Pressed F5. Nothing happened, no errors nothing.
6. Chose Build from the explorer pane.
7. When to a command shell, located the exe.
8. Run the exe, and i just got a blank line and returned to command
prompt.

Here is the code, why is it behaving like this? : -

using System;
using System.Collections;
public class SamplesArrayList
{

public static void Main()
{

// Creates and initializes a new ArrayList.
ArrayList myAL = new ArrayList();
myAL.Add("Hello");
myAL.Add("World");
myAL.Add("!");

// Displays the properties and values of the ArrayList.
Console.WriteLine("myAL");
Console.WriteLine(" Count: {0}", myAL.Count);
Console.WriteLine(" Capacity: {0}", myAL.Capacity);
Console.Write(" Values:");
PrintValues(myAL);
}

public static void PrintValues(IEnumerable myList)
{
foreach (Object obj in myList)
Console.Write(" {0}", obj);
Console.WriteLine();
}

}
/*
This code produces output similar to the following:

myAL
Count: 3
Capacity: f
Values: Hello World !

*/

thankyou,

Gary.

Nov 30 '06 #1
4 2057
Gary!

I just followed your steps 1 through 5 and this is what I got:

<loading of various assemblies snipped>
The thread 0x7a8 has exited with code 0 (0x0).
The thread 0x974 has exited with code 0 (0x0).
'WindowsApplication8.vshost.exe' (Managed): Loaded
'D:\MBS\WindowsApplication8\bin\Debug\WindowsAppli cation8.exe', Symbols
loaded.
myAL
Count: 3
Capacity: 4
Values: Hello World !
The thread 0xe4 has exited with code 0 (0x0).
The thread 0x470 has exited with code 0 (0x0).
The program '[1564] WindowsApplication8.vshost.exe: Managed' has exited
with code 0 (0x0).

Did you bother to look in the output window after you pressed F5. If not
then where did you expect the output to be displayed? You have deleted the
form that the wizard nicely created for you and there is no console. If you
insist in doing it this way then go to the Application tab of the project
Properties and change the Output Type to 'Console Application'. Then when
you run the exe from a command prompt you will see the output.

If you had created a new Console Application project in the first place you
would not have had this 'problem'.

Again I'm going to sound crabby, but please don't treat these newsgoups as
your primary help resource.
YOUR PRIMARY HELP RESOURCE IS ALWAYS THE F1 KEY!!!!!!!!!
<ga********@myway.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
Hi.

I am trying to learn about array lists, and found an example on MSDN. I
tried to compile it but it's not producing any output. I can't see why.
Any ideas?

Here is what I did.

1. Started new windows application.
2. Deleted the code files (program.cs, form.cs)
3. Created a new code file.
4. Pasted the MSDN code into this code file.
5. Pressed F5. Nothing happened, no errors nothing.
6. Chose Build from the explorer pane.
7. When to a command shell, located the exe.
8. Run the exe, and i just got a blank line and returned to command
prompt.

Here is the code, why is it behaving like this? : -

using System;
using System.Collections;
public class SamplesArrayList
{

public static void Main()
{

// Creates and initializes a new ArrayList.
ArrayList myAL = new ArrayList();
myAL.Add("Hello");
myAL.Add("World");
myAL.Add("!");

// Displays the properties and values of the ArrayList.
Console.WriteLine("myAL");
Console.WriteLine(" Count: {0}", myAL.Count);
Console.WriteLine(" Capacity: {0}", myAL.Capacity);
Console.Write(" Values:");
PrintValues(myAL);
}

public static void PrintValues(IEnumerable myList)
{
foreach (Object obj in myList)
Console.Write(" {0}", obj);
Console.WriteLine();
}

}
/*
This code produces output similar to the following:

myAL
Count: 3
Capacity: f
Values: Hello World !

*/

thankyou,

Gary.

Nov 30 '06 #2
Hi Stephany,

I find the F1 key too verbose, I have learnt all i know so far from
asking people in these forums and reading the ECMA specification (which
isn't half as verbose as the F1).
Stephany Young wrote:
Gary!

I just followed your steps 1 through 5 and this is what I got:

<loading of various assemblies snipped>
The thread 0x7a8 has exited with code 0 (0x0).
The thread 0x974 has exited with code 0 (0x0).
'WindowsApplication8.vshost.exe' (Managed): Loaded
'D:\MBS\WindowsApplication8\bin\Debug\WindowsAppli cation8.exe', Symbols
loaded.
myAL
Count: 3
Capacity: 4
Values: Hello World !
The thread 0xe4 has exited with code 0 (0x0).
The thread 0x470 has exited with code 0 (0x0).
The program '[1564] WindowsApplication8.vshost.exe: Managed' has exited
with code 0 (0x0).

Did you bother to look in the output window after you pressed F5. If not
then where did you expect the output to be displayed? You have deleted the
form that the wizard nicely created for you and there is no console. If you
insist in doing it this way then go to the Application tab of the project
Properties and change the Output Type to 'Console Application'. Then when
you run the exe from a command prompt you will see the output.

If you had created a new Console Application project in the first place you
would not have had this 'problem'.

Again I'm going to sound crabby, but please don't treat these newsgoups as
your primary help resource.
YOUR PRIMARY HELP RESOURCE IS ALWAYS THE F1 KEY!!!!!!!!!
<ga********@myway.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
Hi.

I am trying to learn about array lists, and found an example on MSDN. I
tried to compile it but it's not producing any output. I can't see why.
Any ideas?

Here is what I did.

1. Started new windows application.
2. Deleted the code files (program.cs, form.cs)
3. Created a new code file.
4. Pasted the MSDN code into this code file.
5. Pressed F5. Nothing happened, no errors nothing.
6. Chose Build from the explorer pane.
7. When to a command shell, located the exe.
8. Run the exe, and i just got a blank line and returned to command
prompt.

Here is the code, why is it behaving like this? : -

using System;
using System.Collections;
public class SamplesArrayList
{

public static void Main()
{

// Creates and initializes a new ArrayList.
ArrayList myAL = new ArrayList();
myAL.Add("Hello");
myAL.Add("World");
myAL.Add("!");

// Displays the properties and values of the ArrayList.
Console.WriteLine("myAL");
Console.WriteLine(" Count: {0}", myAL.Count);
Console.WriteLine(" Capacity: {0}", myAL.Capacity);
Console.Write(" Values:");
PrintValues(myAL);
}

public static void PrintValues(IEnumerable myList)
{
foreach (Object obj in myList)
Console.Write(" {0}", obj);
Console.WriteLine();
}

}
/*
This code produces output similar to the following:

myAL
Count: 3
Capacity: f
Values: Hello World !

*/

thankyou,

Gary.
Nov 30 '06 #3
And it shows!

As you are effectively saying that you are too lazy to read the
documentation then I think this will my last
response to any of your posts!

<ga********@myway.comwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
Hi Stephany,

I find the F1 key too verbose, I have learnt all i know so far from
asking people in these forums and reading the ECMA specification (which
isn't half as verbose as the F1).
Stephany Young wrote:
>Gary!

I just followed your steps 1 through 5 and this is what I got:

<loading of various assemblies snipped>
The thread 0x7a8 has exited with code 0 (0x0).
The thread 0x974 has exited with code 0 (0x0).
'WindowsApplication8.vshost.exe' (Managed): Loaded
'D:\MBS\WindowsApplication8\bin\Debug\WindowsAppl ication8.exe', Symbols
loaded.
myAL
Count: 3
Capacity: 4
Values: Hello World !
The thread 0xe4 has exited with code 0 (0x0).
The thread 0x470 has exited with code 0 (0x0).
The program '[1564] WindowsApplication8.vshost.exe: Managed' has exited
with code 0 (0x0).

Did you bother to look in the output window after you pressed F5. If not
then where did you expect the output to be displayed? You have deleted
the
form that the wizard nicely created for you and there is no console. If
you
insist in doing it this way then go to the Application tab of the project
Properties and change the Output Type to 'Console Application'. Then when
you run the exe from a command prompt you will see the output.

If you had created a new Console Application project in the first place
you
would not have had this 'problem'.

Again I'm going to sound crabby, but please don't treat these newsgoups
as
your primary help resource.
YOUR PRIMARY HELP RESOURCE IS ALWAYS THE F1 KEY!!!!!!!!!
<ga********@myway.comwrote in message
news:11**********************@16g2000cwy.googlegr oups.com...
Hi.

I am trying to learn about array lists, and found an example on MSDN. I
tried to compile it but it's not producing any output. I can't see why.
Any ideas?

Here is what I did.

1. Started new windows application.
2. Deleted the code files (program.cs, form.cs)
3. Created a new code file.
4. Pasted the MSDN code into this code file.
5. Pressed F5. Nothing happened, no errors nothing.
6. Chose Build from the explorer pane.
7. When to a command shell, located the exe.
8. Run the exe, and i just got a blank line and returned to command
prompt.

Here is the code, why is it behaving like this? : -

using System;
using System.Collections;
public class SamplesArrayList
{

public static void Main()
{

// Creates and initializes a new ArrayList.
ArrayList myAL = new ArrayList();
myAL.Add("Hello");
myAL.Add("World");
myAL.Add("!");

// Displays the properties and values of the ArrayList.
Console.WriteLine("myAL");
Console.WriteLine(" Count: {0}", myAL.Count);
Console.WriteLine(" Capacity: {0}", myAL.Capacity);
Console.Write(" Values:");
PrintValues(myAL);
}

public static void PrintValues(IEnumerable myList)
{
foreach (Object obj in myList)
Console.Write(" {0}", obj);
Console.WriteLine();
}

}
/*
This code produces output similar to the following:

myAL
Count: 3
Capacity: f
Values: Hello World !

*/

thankyou,

Gary.

Nov 30 '06 #4
That is not what I said. I didn't use too verbose as a synonym for too
time consuming.

F1 is ok as a technical reference. It does not however provide answers
to often technically incorrect questions. As a beginner my questions
are often technically incorrect. Further it is not able to provide
solutions to proposed problems, when the problem is often phrased in
completely the wrong way or itself completely misunderstood.

Thanks to the many kind hearted people in these forums I am slowly
becoming more confident at programming, and finding it very enjoyable.
I owe them a great debt, and think their kindness and patience truly
inspiring and motivating.

If my posts have caused annoyance to you please accept my apologies.
Stephany Young wrote:
And it shows!

As you are effectively saying that you are too lazy to read the
documentation then I think this will my last
response to any of your posts!

<ga********@myway.comwrote in message
news:11**********************@n67g2000cwd.googlegr oups.com...
Hi Stephany,

I find the F1 key too verbose, I have learnt all i know so far from
asking people in these forums and reading the ECMA specification (which
isn't half as verbose as the F1).
Stephany Young wrote:
Gary!

I just followed your steps 1 through 5 and this is what I got:

<loading of various assemblies snipped>
The thread 0x7a8 has exited with code 0 (0x0).
The thread 0x974 has exited with code 0 (0x0).
'WindowsApplication8.vshost.exe' (Managed): Loaded
'D:\MBS\WindowsApplication8\bin\Debug\WindowsAppli cation8.exe', Symbols
loaded.
myAL
Count: 3
Capacity: 4
Values: Hello World !
The thread 0xe4 has exited with code 0 (0x0).
The thread 0x470 has exited with code 0 (0x0).
The program '[1564] WindowsApplication8.vshost.exe: Managed' has exited
with code 0 (0x0).

Did you bother to look in the output window after you pressed F5. If not
then where did you expect the output to be displayed? You have deleted
the
form that the wizard nicely created for you and there is no console. If
you
insist in doing it this way then go to the Application tab of the project
Properties and change the Output Type to 'Console Application'. Then when
you run the exe from a command prompt you will see the output.

If you had created a new Console Application project in the first place
you
would not have had this 'problem'.

Again I'm going to sound crabby, but please don't treat these newsgoups
as
your primary help resource.
YOUR PRIMARY HELP RESOURCE IS ALWAYS THE F1 KEY!!!!!!!!!
<ga********@myway.comwrote in message
news:11**********************@16g2000cwy.googlegro ups.com...
Hi.

I am trying to learn about array lists, and found an example on MSDN. I
tried to compile it but it's not producing any output. I can't see why.
Any ideas?

Here is what I did.

1. Started new windows application.
2. Deleted the code files (program.cs, form.cs)
3. Created a new code file.
4. Pasted the MSDN code into this code file.
5. Pressed F5. Nothing happened, no errors nothing.
6. Chose Build from the explorer pane.
7. When to a command shell, located the exe.
8. Run the exe, and i just got a blank line and returned to command
prompt.

Here is the code, why is it behaving like this? : -

using System;
using System.Collections;
public class SamplesArrayList
{

public static void Main()
{

// Creates and initializes a new ArrayList.
ArrayList myAL = new ArrayList();
myAL.Add("Hello");
myAL.Add("World");
myAL.Add("!");

// Displays the properties and values of the ArrayList.
Console.WriteLine("myAL");
Console.WriteLine(" Count: {0}", myAL.Count);
Console.WriteLine(" Capacity: {0}", myAL.Capacity);
Console.Write(" Values:");
PrintValues(myAL);
}

public static void PrintValues(IEnumerable myList)
{
foreach (Object obj in myList)
Console.Write(" {0}", obj);
Console.WriteLine();
}

}
/*
This code produces output similar to the following:

myAL
Count: 3
Capacity: f
Values: Hello World !

*/

thankyou,

Gary.
Nov 30 '06 #5

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

Similar topics

38
by: jrlen balane | last post by:
basically what the code does is transmit data to a hardware and then receive data that the hardware will transmit. import serial import string import time from struct import * ser =...
17
by: savesdeday | last post by:
In my beginnning computer science class we were asked to translate a simple interest problem. We are expected to write an algorithm that gets values for the starting account balance B, annual...
3
by: happy | last post by:
/* Book name : The prodessional programmers guide to C File name : E:\programs\tc\iti01\ch09\main\01setupm.c Program discription: file setuping -up -Version 01-ver01-W Logic ...
2
by: Todd | last post by:
I am somewhat new to ASP.NET and I am probably overlooking some basic rule that's causing my error. Anyways, here's the scoop: I am using a DataReader to access a SQL stored procedure. I want...
24
by: kalamantina | last post by:
#include "stdafx.h" #include <stdio.h> #define output( x ) printf( #x "\r\n" );fflush( stdout ) class CMyBase { public: CMyBase() { output( CMyBase() ); f(*this);
8
by: ianenis.tiryaki | last post by:
well i wrote this code but it doesn't work and shows me bunch of syntax if you can help me out finding them i would appreciate it! the program should do simple calculations and no parenthesis...
87
by: pereges | last post by:
I have a C program which I created on Windows machine. I have compiled and executed the program on windows machine and it gives me the consistent output every time i run it. for eg. input a = 2,...
4
by: adrianmepham | last post by:
Hi group, I have been given the task at work of producing a selection frogram for a range of our air handling units. I have a little experience of programing in VB 6 from many years ago, but...
1
by: jerry | last post by:
i have written a simple phonebook program,i'll show you some of the codes,the program's head file is member.h . i suppose the head file works well.so i don't post it. here's the clips of main...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
0
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...
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.