Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7717443
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T02:54:00+00:00 2026-06-01T02:54:00+00:00

Writing my first C# application…never touched the language before and not much of a

  • 0

Writing my first C# application…never touched the language before and not much of a programmer! I have been googling around and got a few books but thought the best way to learn is to actually try some coding!

Anyway, been asked to write a little inventory system for all our 15000 servers and I can do this in powershell fine but wanted a challenge and try my hand at C#.

I have the below code and this works fine in a command propmpt window but how to I put this into a winform app? I assume I need to change the “Console.WriteLine” to something else…just I do not know what the something else is! I will probably add in a listbox to show the details in there rather than executing a command prompt..

I will be ading in loads of stuff – like memory info and disk sizes etc so getting this right would help me…plus, no doubt I will ask loads of questions!

Code that works:

using System;

namespace OsVersionSample

{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Operating System Detaiils");
            OperatingSystem os = Environment.OSVersion;
            Console.WriteLine("OS Version: " + os.Version.ToString());
            Console.WriteLine("OS Platoform: " + os.Platform.ToString());
            Console.WriteLine("OS SP: " + os.ServicePack.ToString());
            Console.WriteLine("OS Version String: " + os.VersionString.ToString());
            Console.WriteLine();

            // Get Version details

            Version ver = os.Version;
            Console.WriteLine("Major version: " + ver.Major);
            Console.WriteLine("Major Revision: " + ver.MajorRevision);
            Console.WriteLine("Minor version: " + ver.Minor);
            Console.WriteLine("Minor Revision: " + ver.MinorRevision);
            Console.WriteLine("Build: " + ver.Build);

            Console.ReadLine();
        }
    }
}

Code I want to put into a winform:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication2
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Console.WriteLine("Operating System Detaiils");

            OperatingSystem os = Environment.OSVersion;

            Console.WriteLine("OS Version: " + os.Version.ToString());

            Console.WriteLine("OS Platoform: " + os.Platform.ToString());

            Console.WriteLine("OS SP: " + os.ServicePack.ToString());

            Console.WriteLine("OS Version String: " + os.VersionString.ToString());

            Console.WriteLine();



            // Get Version details

            Version ver = os.Version;

            Console.WriteLine("Major version: " + ver.Major);

            Console.WriteLine("Major Revision: " + ver.MajorRevision);

            Console.WriteLine("Minor version: " + ver.Minor);

            Console.WriteLine("Minor Revision: " + ver.MinorRevision);

            Console.WriteLine("Build: " + ver.Build);



            Console.ReadLine(); 
        }
    }
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T02:54:01+00:00Added an answer on June 1, 2026 at 2:54 am

    Tou can add listbox to form and do something like this

     private void button1_Click(object sender, EventArgs e)
                {
        listbox1.items.add("Operating System Detaiils");
         OperatingSystem os = Environment.OSVersion;
    listbox1.items.add("OS Version: " + os.Version.ToString());
        // and so on...
    
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am writing my first Android application, and I have been struggling with this
I am writing my first Android application and have some problems with handing around
I'm writing my first Android application and trying to get my head around communication
I've been working on writing my first MVC3 application for a little while and
I'm writing Baby's First Web Application. My first task has been to set up
I'm writing my first iPhone application and I'm having trouble switching views. I have
I am about to start writing my first big CodeIgniter application, but before I
I am writing my first little Access 2003 application. I have two queries that
I'm writing my first real MVC-application with PHP. I'm not using a framework because
I'm writing my first web application (still!), and have a problem activating user accounts.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.