Mirage Engine
C# Project (1) - Printable Version

+- Mirage Engine (https://mirage-engine.uk/forums)
+-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61)
+--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18)
+---- Forum: Programming (https://mirage-engine.uk/forums/forumdisplay.php?fid=24)
+----- Forum: .NET (https://mirage-engine.uk/forums/forumdisplay.php?fid=35)
+----- Thread: C# Project (1) (/showthread.php?tid=2823)



C# Project (1) - Exadon - 29-05-2009

Make a console or windows app that inputs a users birthdate and outputs their age.

This program should have comments as well as error catching.

Best program wins a cookie.

Overview:
  • Figure out the age of the person from date inputted.

Notes:
  • Application can be either console or windows application.



Re: C# Project (1) - Toast - 04-06-2009

Windows Form Application.


Re: C# Project (1) - Tony - 04-06-2009

Toast Wrote:Windows Form Application.

++ my vote

I'm 16 years, 4 months, and 18 days old.


Re: C# Project (1) - Coke - 04-06-2009

Do you mind if I do it in Java?


Re: C# Project (1) - Exadon - 04-06-2009

Yeah , you can do it in Java.


Re: C# Project (1) - Kamori - 05-06-2009

I tried doing this in VB.net and I have a problem with enum's I used Toast's code as a reference but I get a problem with this line of code

Code:
[Enum].Parse(GetType(eMonths), CMB_Month.Text)


and the error I get
Quote:Must specify valid information for parsing in the string.



Re: C# Project (1) - Exadon - 06-06-2009

Very nice work toast and james. Toast, I like that your project works on events besides a normal button click event


Re: C# Project (1) - Toast - 06-06-2009

Thanks, it's not that hard to do lol.


Re: C# Project (1) - unknown - 06-06-2009

I wrote mine in java.. I also made a custom coded from scratch swing GUI and a JNLP file, so if you wanna learn any of that read through my code =).

Ageulator.java
[code]
import javax.swing.JFrame;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.SwingUtilities;
import javax.swing.JOptionPane;
import java.awt.BorderLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.util.Calendar;

// The main frame, all the gui elements go on here
class MainFrame extends JFrame implements ActionListener {

Calendar m_calendar = Calendar.getInstance();
JComboBox m_birthMonth = new JComboBox();
JComboBox m_birthDay = new JComboBox();
JComboBox m_birthYear = new JComboBox();

// Create and show the main frame
public MainFrame() {
// Close the application when we exit
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setResizable(true);
this.setTitle("Ageulator");
// Create all the components on the main frame
this.createGUI();
// Remove any extra space between components
this.pack();
// Start application in the center of the screen
this.setLocationRelativeTo(null);
this.setVisible(true);
}

// Create all the components and put them on the main frame
private void createGUI() {
// Simple GUI layout manager
this.setLayout(new BorderLayout());
m_birthMonth.addItem("--");
// Allow the user to select months 1-12
for (int i = 1; i