//populate the race comboBox
        public void LoadComboBox()
        {
            //empty out the comboBox
            comboBox1.Items.Clear();
            //load the names of the races from file
            var races = new DataTable();

            CommonSQL.BuildIfNotExsistDB();
            using (var conn = new SQLiteConnection(CommonSQL.SQLiteConnectionString))
            {
                conn.Open();
                using (var cmd = new SQLiteCommand())
                {
                    cmd.Connection  = conn;
                    cmd.CommandText = "select Name from Race;";
                    SQLiteDataReader r = cmd.ExecuteReader();

                    var daRaces = new SQLiteDataAdapter(cmd);
                    while (r.Read())
                    {
                        this.comboBox1.Items.Add(r[0]);
                    }
                }
                conn.Close();
            }
            //if there is data, load the first value
            if (comboBox1.Items.Count > 0)
            {
                comboBox1.SelectedIndex = 0;
            }
        }
Exemple #2
0
        static void Main()
        {
            CommonSQL.BuildIfNotExsistDB();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new StartScreen());

            //Class1.test();
        }