5 Replies - 1077 Views - Last Post: 24 May 2012 - 06:54 AM Rate Topic: -----

#1 Raeesa  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 5
  • Joined: 23-May 12

C# error blank console application

Posted 23 May 2012 - 02:47 AM

HI there

I am a newbie to Programming and need some Help :)

I have this project that i am working with its called Tempretures and the idea is to use a console application
to make the temoreture change everytime

I have used what my lecturer has given me as a base Line but when i run my Application it comes as a blank black screen

I dont know what happen i checked my coding over and over again but failed.

i checked on stackoverflow, Goggle<webopedia but nothing as well .

Please advice me what i can do next

Thanks :)

Is This A Good Question/Topic? 0
  • +

Replies To: C# error blank console application

#2 negligible  Icon User is offline

  • D.I.C Regular

Reputation: 62
  • View blog
  • Posts: 302
  • Joined: 02-December 10

Re: C# error blank console application

Posted 23 May 2012 - 03:42 AM

Post your code.

Inbetween code tags like this

[code]Your code here
[/code]

It sounds like you are missing the appropriate "Console.WriteLine()" method to send your output back to the console screen.
Was This Post Helpful? 1
  • +
  • -

#3 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5676
  • View blog
  • Posts: 12,201
  • Joined: 02-June 10

Re: C# error blank console application

Posted 23 May 2012 - 06:29 AM

neg: You can't actually use code tags when trying to show how to use code tags

:code:

Attached Image
Was This Post Helpful? 0
  • +
  • -

#4 Raeesa  Icon User is offline

  • New D.I.C Head

Reputation: -1
  • View blog
  • Posts: 5
  • Joined: 23-May 12

Re: C# error blank console application

Posted 24 May 2012 - 03:28 AM

Hi there Thanks so much for helping me :)

In my program This is what i have :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Question_1_Events
{
    class Program
    {
        static int _Tempreture = 28;

        static void Main(string[] args)
        {
            TempretureChanged tempreture = new TempretureChanged();
            tempreture.tempreturechanges = TempretureChanged();

            Console.ReadLine();
        }

        private static object TempretureChanged()
        {
            return _Tempreture;
        }      

        private static void tempreturechanges()
        {
            _Tempreture++;

            Console.WriteLine("Tempreture changed from {1} to {28}.", _Tempreture);

        }
    }
}

And in my Class which i created in order to complete Prgram :

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Timers;

namespace Question_1_Events
{
    public delegate void TempretureEventHandler();

    class TempretureChanged
    {
        public TempretureChanged()
        {
            _timer = new Timer();
            _timer.Interval = 1000.0;
            _timer.Elapsed += TimerElapsed;
            _timer.Start();
        }

        public event TempretureEventHandler TempretureChanges;
        public event TempretureEventHandler Tempreturechanged;

        private Timer _timer;

        public void TimerElapsed(object sender, ElapsedEventArgs e)
        {
            TempretureEventHandler handler = Tempreturechanged;
            if (handler != null)
            {
                handler();
            }
        }

        public object tempreturechanges { get; set; }

       
    }
 }



I hope what I did is right id be soo excited if it is because its my first time doing this :)

Thanks Again

MOD EDIT: AGAIN ADDED CODE TAGS.

This post has been edited by JackOfAllTrades: 24 May 2012 - 06:34 AM

Was This Post Helpful? -1
  • +
  • -

#5 Michael26  Icon User is offline

  • DIC-head, major DIC-head
  • member icon

Reputation: 362
  • View blog
  • Posts: 1,539
  • Joined: 08-April 09

Re: C# error blank console application

Posted 24 May 2012 - 05:30 AM

You need to use Console.Writeline to write something to the console output.
Was This Post Helpful? 0
  • +
  • -

#6 eclipsed4utoo  Icon User is offline

  • Not Your Ordinary Programmer
  • member icon

Reputation: 1526
  • View blog
  • Posts: 5,961
  • Joined: 21-March 08

Re: C# error blank console application

Posted 24 May 2012 - 06:54 AM

I am at a loss of words.

I have a hard time believing that you wrote both the Program.cs code(which is horrible), but you wrote the TempretureChanged class, which has a constructor, delegate, and events. There is absolutely no way that you can write the code to create a custom event, but not know how to properly subscribe to that event.

My advice? Delete all of your code, start at chapter 1 in your book, and start reading again.
Was This Post Helpful? 4
  • +
  • -

Page 1 of 1