Click here to Skip to main content
15,909,205 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I really don't know how to converted into windows form i have the console app code

What I have tried:

im newbie trying to learn please help me i have code in console app but i don't know how to transfer in windows form  thank you for the help every one ^_^  so this is my console app code:

using System;
public class HollowSquare
{
    public static void Main()
    {
        int row, column;
 
        Console.Write("Enter a symbol: ");
        int symbol = Convert.ToInt32(Console.ReadLine());
 
        Console.Write("Enter the desired width: ");
        int width = Convert.ToInt32(Console.ReadLine());
 
        Console.Write("Enter the desired height: ");
        int height = Convert.ToInt32(Console.ReadLine());
 
        Console.WriteLine(); 
 
        for(row = 1; row <= height; row++)
        {
            for(column = 1; column <= width; column++)
            {
                if ((row == 1) || (row == height))
                    Console.Write(symbol);
                else
                {
                    if ((column == 1) || (column == width))
                        Console.Write(symbol);
                    else
                        Console.Write(" ");
                }
            } 
            Console.WriteLine();                 
        }   
    }
}
Posted
Updated 21-Feb-20 4:36am
v2

Obviously the first thing you need to do is to create a Windows Form application, as stated in your instructions. See windows forms C# - Google Search[^] for some useful tutorials. But I would suggest you ignore the Youtube videos.
 
Share this answer
 
Read your tutorial notes - teachers almost never set homework on subjects they haven't touched, or haven't told you to read up on, so the basics are almost certainly covered.

Create a new solution, make it a WinForms project, and drag controls from the toolbox. Your tutorials so far should tell you what to do next.
 
Share this answer
 
One more thing that call to Convert is going to bite you in the ass. Run your console ap and enter some letters instead of a number and you will see what I mean. Use TryParse().
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900