Calculating Age with Zodiac Sign In C#

Calculating Age with Zodiac Sign In C#

calculateAgeZodiacFig.3

If you find it hard to Calculating Age with Zodiac Sign In C# of your relative or anyone else close to you. Even its just a simple arithmetic, it still makes you feel dizzy to know someone’s age just by its year.

This tutorial will help you on how to calculate age with its corresponding zodiac sign. Now, you don’t have to google what’s your zodiac sign or your friends’ because this method will let you know about it after calculating your age. This is not just useful but its also kinda fun.

Let’s begin:

Open Microsoft Visual Studio and create a new windows form application. after that, do the form just like this.

calculateAgeZodiacFig.1

After setting up the form, go to the solution explorer and hit the “view code” to fire the code editor.

calculateAgeZodiacFig.2

In the code editor, declare and initialize the variables that you’re going to use in public.

//SET AN ARRAY VARIABLE TO STORE THE VALUE OF THE ZODIAC SIGNS ON IT.
 string[] Zodiac_Sign = new string[12]{"Aries", "Taurus", "Gemini", "Cancer","Leo", "Virgo", "Libra",
 "Scorpio", "Sagittarius","Capricorn"ca, "Aquarius", "Pisces"};
 //SET A VARIABLE TO REPRESENTS YOUR AGE.
 int age;

After that, go back to the design view, double-click the “calculate” button and do the following code in the method.

 //SET THE STRING VARIABLE REPRESENT A FORMATED DATETIMEPICKER TO THE NAME OF THE MONTHS.
 string months = dtpDateBirth.Value.Date.ToString("MMMM");
 //SET THE INTEGR VARIABLE REPRESENT A FORMATED DATETIMEPICKER TO A VALUE OF THE DAY.
 int days = int.Parse(dtpDateBirth.Value.Date.ToString("dd"));
 //CALCULATING THE INTERVAL BETWEEN THE DATE OF BIRTH AND THE END OF THE DATE.
 age = dtpEndDate.Value.Year - dtpDateBirth.Value.Year;
 //CLEARING THE LISTBOX.
 listBox1.Items.Clear();
 //ADDING THE VALUE OF THE AGE IN THE LISTBOX TAHT YOU HAVE CALCULATED.
 listBox1.Items.Add("Age : " + age.ToString()).ToString();

 switch (months)
 {
 case "January":
 if (days >= 1 && days <= 19)
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[9]);
 }
 else
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[10]);
 }
 break;
 case "February":
 if (days >= 1 && days <= 19)
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[10]);
 }
 else
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[11]);
 }
 break;
 case "March":
 if (days >= 1 && days <= 19)
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[0]);
 }
 else
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[11]);
 }
 break;
 case "April":
 if (days >= 1 && days <= 19)
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[0]);
 }
 else
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[1]);
 }
 break;
 case "May":
 if (days >= 1 && days <= 19)
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[1]);
 }
 else
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[2]);
 }
 break;
 case "June":
 if (days >= 1 && days <= 19)
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[2]);
 }
 else
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[3]);
 }
 break;
 case "July":
 if (days >= 1 && days <= 19)
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[3]);
 }
 else
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[4]);
 }
 break;
 case "August":
 if (days >= 1 && days <= 19)
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[4]);
 }
 else
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[5]);
 }
 break;
 case "September":
 if (days >= 1 && days <= 19)
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[5]);
 }
 else
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[6]);
 }
 break;
 case "October":
 if (days >= 1 && days <= 19)
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[6]);
 }
 else
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[7]);
 }
 break;
 case "november":
 if (days >= 1 && days <= 19)
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[7]);
 }
 else
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[8]);
 }
 break;
 case "December":
 if (days >= 1 && days <= 19)
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[8]);
 }
 else
 {
 //ADDING A ZODIAC SIGN IN THE LIST BOXS.
 listBox1.Items.Add("Zodiac Sign :" + Zodiac_Sign[9]);
 }
 break; 
 };

Output:

calculateAgeZodiacFig.3

For all students who need a programmer for your thesis system or anyone who needs a sourcecode in any programming languages. You can contact me @ :
Email – [email protected]
Mobile No. – 09305235027 – tnt

Download Source code

ABOUT PROJECTPROJECT DETAILS
Project Name :Calculating Age with Zodiac Sign
Project Platform :C#
Programming Language Used:C# Programming Language
Developer Name :itsourcecode.com
IDE Tool (Recommended):Visual Studio 2019
Project Type :Desktop Application
Database:None
Upload Date and Time:July 27, 2016- 8:59 am

Frequently Asked Questions

How does this C# project work?

Built with C# WinForms (.NET Framework or .NET 6/7/8) and SQL Server backend. Standard structure: Form designer → code-behind event handlers → ADO.NET data access layer → SQL Server. Login form for auth. Ready to extend for BSIT capstone scope.

What .NET and SQL Server versions does this project require?

Most projects in this batch use C# WinForms on .NET Framework 4.5+ (the dominant stack for tutorial sites) with SQL Server 2012 Express or higher. A few newer projects use .NET 6/7/8. To run: install Visual Studio 2019 / 2022 (Community edition is free), install SQL Server Express + SSMS, open the .sln file, build, run.

How do I set up the database for this C# project?

Open SQL Server Management Studio (SSMS) and connect to your SQL Server instance (e.g. localhost\SQLEXPRESS). Right-click Databases > Restore Database OR > New Database then import the included .sql script. Update the connection string in App.config (or in code-behind) with your server name + credentials. Rebuild and run.

Can I use this C# project for a BSIT capstone or thesis?

Yes, but extend it. A bare CRUD form is too narrow for full capstone scope. Add: role-based access (admin/staff/customer login redirect), Crystal Reports or RDLC reports, dashboard with Chart controls, audit log, multi-branch support. Pair with Chapter 1-5 documentation matching your panel’s rubric.

Why am I getting ‘connection error’ or ‘object reference not set’?

Three common C# issues: (1) Connection error: SQL Server isn’t running OR connection string in App.config has wrong server name. Open SQL Server Configuration Manager + verify SQL Server (SQLEXPRESS) service is running. (2) NullReferenceException: a control reference or DB column returned NULL, add a check or use ?? operator. (3) Build error ‘The type or namespace could not be found’: missing assembly reference, add via Project > Add Reference.

Where can I find more C# projects with source code?

Browse the C# Projects hub for the full library. For other .NET stacks see VB.NET Projects (300+ Windows Forms systems). For ASP.NET WebForms see ASP.NET Projects. For BSIT capstone idea lists see 150 Best Capstone Project Ideas.

1 thought on “Calculating Age with Zodiac Sign In C#”

Leave a Comment