10 Replies - 1234 Views - Last Post: 14 April 2012 - 03:01 PM Rate Topic: -----

#1 rickster26ter  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 14-April 12

How do I create this box in the console?

Posted 14 April 2012 - 12:32 PM

I was given a project to create employee information, create objects for them, and calculate their salary. I got done with all that perfectly fine, but an addon extra credit part is to display the information using a box (simulated check and pat stub) :shown here

http://s1267.photobu...urrent=cbox.jpg

My class hasn't ever explained how to create such a thing, we just got into object oriented programming just barely. My guess would be to do a bunch of console.WriteLines, but It wouldn't look like the one my teacher wants in the exe. here-

http://debryro.tc.uv...ject10/p10.html

Any pointer to what I could do would be very helpful! Thanks.

Is This A Good Question/Topic? 0
  • +

Replies To: How do I create this box in the console?

#2 tlhIn`toq  Icon User is online

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

Reputation: 5429
  • View blog
  • Posts: 11,641
  • Joined: 02-June 10

Re: How do I create this box in the console?

Posted 14 April 2012 - 12:44 PM

Quote

My guess would be to do a bunch of console.WriteLines, but It wouldn't look like the one my teacher wants in the exe.


Good guess. Why would it not look like the one in the tiny reduced screen shot that is hard to see? That one looks like it is in a console. Therefore it can be done with writeline. Programmers did this sort of thing with writeline for decades before graphical interfaces. it was called DOS.

What have you tried so far to accomplish this part? Can we see your code to do this?
Was This Post Helpful? 0
  • +
  • -

#3 rickster26ter  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 14-April 12

Re: How do I create this box in the console?

Posted 14 April 2012 - 12:56 PM

I didn't start trying yet. It's just that I wrote |'s in the console.writeline, but they didn't connect perfectly as in the .exe. I think I need to do it using GUI..? I haven't learned that yet.
Was This Post Helpful? 0
  • +
  • -

#4 Sergio Tapia  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1252
  • View blog
  • Posts: 4,168
  • Joined: 27-January 10

Re: How do I create this box in the console?

Posted 14 April 2012 - 01:01 PM

Your screenshot is 10px by 10px. Make it bigger lol.
Was This Post Helpful? 0
  • +
  • -

#5 rickster26ter  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 14-April 12

Re: How do I create this box in the console?

Posted 14 April 2012 - 01:16 PM

Is this better?

Attached Image

This post has been edited by tlhIn`toq: 14 April 2012 - 01:19 PM

Was This Post Helpful? 0
  • +
  • -

#6 tlhIn`toq  Icon User is online

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

Reputation: 5429
  • View blog
  • Posts: 11,641
  • Joined: 02-June 10

Re: How do I create this box in the console?

Posted 14 April 2012 - 01:16 PM

View Postrickster26ter, on 14 April 2012 - 01:56 PM, said:

I didn't start trying yet. It's just that I wrote |'s in the console.writeline, but they didn't connect perfectly as in the .exe. I think I need to do it using GUI..? I haven't learned that yet.



The bar character on a keyboard is meant to have a space between lines.
You need to build the box shapes using ASCII characters
http://www.asciitable.com/

Attached Image

This post has been edited by tlhIn`toq: 14 April 2012 - 01:23 PM

Was This Post Helpful? 0
  • +
  • -

#7 rickster26ter  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 14-April 12

Re: How do I create this box in the console?

Posted 14 April 2012 - 01:29 PM

Thank you so much guys! If it wouldn't be too much to ask, I haven't done this before, so is there a tutorial, or could one of you give me a hint to writing it? Do I just write like U+2501 in console.writeline? Or do I need to do more?
Was This Post Helpful? 0
  • +
  • -

#8 tlhIn`toq  Icon User is online

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

Reputation: 5429
  • View blog
  • Posts: 11,641
  • Joined: 02-June 10

Re: How do I create this box in the console?

Posted 14 April 2012 - 01:36 PM

I think that's why they call it extra credit. If we tell you then what's the point of you getting the credit.

At least make an effort on your now that you have a direction.

Then come back to this thread with your code if you are still having trouble.
Was This Post Helpful? 1
  • +
  • -

#9 rickster26ter  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 14-April 12

Re: How do I create this box in the console?

Posted 14 April 2012 - 02:12 PM

Could I get help on underlining a word?

    static void Main()
    {
        Console.SetWindowSize(85, 45);
        Console.WriteLine("╒═════════════════════════════════════════════════════════════════════════════╗");
        Console.WriteLine("│FluffShuffle Electronics                                     14 Apr, 2012    ║");
        Console.WriteLine("│                                                                             ║");
        Console.WriteLine("│                                                                             ║");
        Console.WriteLine("│                                                                             ║");
        Console.WriteLine("│                                                                             ║");
        Console.WriteLine("│                                                                             ║");
        Console.WriteLine("│                                                                             ║");
        Console.WriteLine("│                                                                             ║");
        Console.WriteLine("│                                                                             ║");
        Console.WriteLine("│                                                                             ║");
        Console.WriteLine("│                                                                             ║");
        Console.WriteLine("│                                                                             ║");
        Console.WriteLine("│                                                                             ║");
        Console.WriteLine("│                                                                             ║");



        Console.ReadLine();
    }//End Main()


Was This Post Helpful? 0
  • +
  • -

#10 tlhIn`toq  Icon User is online

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

Reputation: 5429
  • View blog
  • Posts: 11,641
  • Joined: 02-June 10

Re: How do I create this box in the console?

Posted 14 April 2012 - 02:28 PM

i don't think console underlines. You'll have to use an ASCII character of 175 on the row below the text to simulate the underline.
Was This Post Helpful? 0
  • +
  • -

#11 sepp2k  Icon User is online

  • D.I.C Lover
  • member icon

Reputation: 2085
  • View blog
  • Posts: 3,170
  • Joined: 21-June 11

Re: How do I create this box in the console?

Posted 14 April 2012 - 03:01 PM

It should also be mentioned that the Console class has properties that allow you to set the cursor position. This might be a better option to align stuff then to draw a bunch of spaces until the cursor is at the right position.

For example you could define a method WriteUnderlined, that writes a string to the console and a bunch of line-characters on the row below it, by writing the string, then setting the cursor position to one row below the position the cursor was at before you wrote the string, and then write a bunch of line-characters (where "a bunch" means "as many as the string you wrote is long").
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1