예제 #1
0
        private void saveLocationButton_Click(object sender, EventArgs e)
        {
            int pos;
            Location loc = new Location();
            DatabaseHandler db;

            if (int.TryParse(positionTB.Text, out pos)) {
                loc.Position = pos;
                loc.Name = nameTB.Text;
                loc.info = informationRTB.Text;

                if (loc.Name.Length > 0) {
                    db = new DatabaseHandler();
                    db.saveLocation(loc);
                    this.Close();
                } else {
                    MessageBox.Show("Platsen måste ha ett namn");
                }

            } else {
                MessageBox.Show("Position måste vara i siffror endast");
            }
        }