My ComboBox__SelectedIndexChanged won't start

52 views Asked by At

i have some issues with my ComboBox. when i press or do anything it wont start up. At first i thought it was my code but i have now done a simple Messagebox message and still it wont work, the code that is commented out is the code that has to be runned.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;

namespace Dark_Heresy
{
    public partial class Talents : Form
    {
        public Talents()
        {
            InitializeComponent();
        }

        private void cb_Talents_SelectedIndexChanged(object sender, EventArgs e)
        {

            MessageBox.Show("Test");


            //string constring = "datasource = localhost; port = 3306; username = root; password = Mypass;";
            //string Query = "SELECT * FROM dark_heresy.talents WHERE TalentName='" + cb_Talents.Text + "' ;";
            //MySqlConnection conDataBase = new MySqlConnection(constring);
            //MySqlCommand cmdDataBase = new MySqlCommand(Query, conDataBase);
            //MySqlDataReader myReader;

            //try
            //{
            //    conDataBase.Open();
            //    myReader = cmdDataBase.ExecuteReader();

            //    while (myReader.Read())
            //    {

            //        string description = myReader.GetString("Description");
            //        string strength = myReader.GetInt32("R_Str").ToString();
            //        string weaponskill = myReader.GetInt32("R_WS").ToString();
            //        string ballisticskill = myReader.GetInt32("R_BS").ToString();
            //        string fellowship = myReader.GetInt32("R_Fel").ToString();
            //        string perception = myReader.GetInt32("R_Per").ToString();
            //        string intelligence = myReader.GetInt32("R_Int").ToString();
            //        string agility = myReader.GetInt32("R_Agi").ToString();
            //        string willpower = myReader.GetInt32("R_WP").ToString();
            //        string toughness = myReader.GetInt32("R_Tough").ToString();
            //        string talentrequired = myReader.GetString("Talent_required");
            //        string skillrequired = myReader.GetString("Skill_required");
            //        string classrequired = myReader.GetString("Class_required");

            //        TextDescription.Text = description;
            //        TextStrengh.Text = strength;
            //        TextWeaponskill.Text = weaponskill;
            //        TextBallisticskill.Text = ballisticskill;
            //        TextFellowship.Text = fellowship;
            //        TextPerception.Text = perception;
            //        TextIntelligence.Text = intelligence;
            //        TextAgility.Text = agility;
            //        TextWillpower.Text = willpower;
            //        TextToughness.Text = toughness;
            //        TextTalent.Text = talentrequired;
            //        TextSkill.Text = skillrequired;
            //        TextClass.Text = classrequired;

            //    }
            //}

            //    catch (Exception ex)
            //    {
            //        MessageBox.Show("Error: \r\n" + ex);
            //    }

            }

        private void Talents_Load(object sender, EventArgs e)
        {

        }

        }
    }

What is wrong with it? is there a setting that has to be changed?

Talents.Designer.cs

namespace Dark_Heresy
{
    partial class Talents
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Talents));
            this.grp_Attributes = new System.Windows.Forms.GroupBox();
            this.TextBallisticskill = new System.Windows.Forms.TextBox();
            this.TextWeaponskill = new System.Windows.Forms.TextBox();
            this.TextFellowship = new System.Windows.Forms.TextBox();
            this.TextWillpower = new System.Windows.Forms.TextBox();
            this.TextPerception = new System.Windows.Forms.TextBox();
            this.TextIntelligence = new System.Windows.Forms.TextBox();
            this.TextAgility = new System.Windows.Forms.TextBox();
            this.TextToughness = new System.Windows.Forms.TextBox();
            this.TextStrengh = new System.Windows.Forms.TextBox();
            this.required_Ballisticskill = new System.Windows.Forms.Label();
            this.required_Weaponskill = new System.Windows.Forms.Label();
            this.required_Fellowship = new System.Windows.Forms.Label();
            this.required_Willpower = new System.Windows.Forms.Label();
            this.required_Perception = new System.Windows.Forms.Label();
            this.required_Intelligence = new System.Windows.Forms.Label();
            this.required_Agility = new System.Windows.Forms.Label();
            this.required_Toughness = new System.Windows.Forms.Label();
            this.required_Strength = new System.Windows.Forms.Label();
            this.cb_Talents = new System.Windows.Forms.ComboBox();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.label4 = new System.Windows.Forms.Label();
            this.TextDescription = new System.Windows.Forms.TextBox();
            this.TextClass = new System.Windows.Forms.TextBox();
            this.TextSkill = new System.Windows.Forms.TextBox();
            this.TextTalent = new System.Windows.Forms.TextBox();
            this.label5 = new System.Windows.Forms.Label();
            this.button1 = new System.Windows.Forms.Button();
            this.grp_Attributes.SuspendLayout();
            this.SuspendLayout();
            // 
            // grp_Attributes
            // 
            this.grp_Attributes.Controls.Add(this.TextBallisticskill);
            this.grp_Attributes.Controls.Add(this.TextWeaponskill);
            this.grp_Attributes.Controls.Add(this.TextFellowship);
            this.grp_Attributes.Controls.Add(this.TextWillpower);
            this.grp_Attributes.Controls.Add(this.TextPerception);
            this.grp_Attributes.Controls.Add(this.TextIntelligence);
            this.grp_Attributes.Controls.Add(this.TextAgility);
            this.grp_Attributes.Controls.Add(this.TextToughness);
            this.grp_Attributes.Controls.Add(this.TextStrengh);
            this.grp_Attributes.Controls.Add(this.required_Ballisticskill);
            this.grp_Attributes.Controls.Add(this.required_Weaponskill);
            this.grp_Attributes.Controls.Add(this.required_Fellowship);
            this.grp_Attributes.Controls.Add(this.required_Willpower);
            this.grp_Attributes.Controls.Add(this.required_Perception);
            this.grp_Attributes.Controls.Add(this.required_Intelligence);
            this.grp_Attributes.Controls.Add(this.required_Agility);
            this.grp_Attributes.Controls.Add(this.required_Toughness);
            this.grp_Attributes.Controls.Add(this.required_Strength);
            this.grp_Attributes.Location = new System.Drawing.Point(225, 117);
            this.grp_Attributes.Name = "grp_Attributes";
            this.grp_Attributes.Size = new System.Drawing.Size(158, 377);
            this.grp_Attributes.TabIndex = 4;
            this.grp_Attributes.TabStop = false;
            this.grp_Attributes.Text = "Required Attributes";
            // 
            // TextBallisticskill
            // 
            this.TextBallisticskill.Location = new System.Drawing.Point(89, 280);
            this.TextBallisticskill.Name = "TextBallisticskill";
            this.TextBallisticskill.Size = new System.Drawing.Size(21, 20);
            this.TextBallisticskill.TabIndex = 17;
            // 
            // TextWeaponskill
            // 
            this.TextWeaponskill.Location = new System.Drawing.Point(89, 251);
            this.TextWeaponskill.Name = "TextWeaponskill";
            this.TextWeaponskill.Size = new System.Drawing.Size(22, 20);
            this.TextWeaponskill.TabIndex = 16;
            // 
            // TextFellowship
            // 
            this.TextFellowship.Location = new System.Drawing.Point(88, 217);
            this.TextFellowship.Name = "TextFellowship";
            this.TextFellowship.Size = new System.Drawing.Size(23, 20);
            this.TextFellowship.TabIndex = 15;
            // 
            // TextWillpower
            // 
            this.TextWillpower.Location = new System.Drawing.Point(89, 191);
            this.TextWillpower.Name = "TextWillpower";
            this.TextWillpower.Size = new System.Drawing.Size(22, 20);
            this.TextWillpower.TabIndex = 14;
            // 
            // TextPerception
            // 
            this.TextPerception.Location = new System.Drawing.Point(89, 158);
            this.TextPerception.Name = "TextPerception";
            this.TextPerception.Size = new System.Drawing.Size(22, 20);
            this.TextPerception.TabIndex = 13;
            // 
            // TextIntelligence
            // 
            this.TextIntelligence.Location = new System.Drawing.Point(89, 124);
            this.TextIntelligence.Name = "TextIntelligence";
            this.TextIntelligence.Size = new System.Drawing.Size(22, 20);
            this.TextIntelligence.TabIndex = 12;
            // 
            // TextAgility
            // 
            this.TextAgility.Location = new System.Drawing.Point(88, 92);
            this.TextAgility.Name = "TextAgility";
            this.TextAgility.Size = new System.Drawing.Size(23, 20);
            this.TextAgility.TabIndex = 11;
            // 
            // TextToughness
            // 
            this.TextToughness.Location = new System.Drawing.Point(88, 65);
            this.TextToughness.Name = "TextToughness";
            this.TextToughness.Size = new System.Drawing.Size(23, 20);
            this.TextToughness.TabIndex = 10;
            // 
            // TextStrengh
            // 
            this.TextStrengh.Location = new System.Drawing.Point(88, 30);
            this.TextStrengh.Name = "TextStrengh";
            this.TextStrengh.Size = new System.Drawing.Size(23, 20);
            this.TextStrengh.TabIndex = 9;
            // 
            // required_Ballisticskill
            // 
            this.required_Ballisticskill.AutoSize = true;
            this.required_Ballisticskill.Location = new System.Drawing.Point(19, 283);
            this.required_Ballisticskill.Name = "required_Ballisticskill";
            this.required_Ballisticskill.Size = new System.Drawing.Size(62, 13);
            this.required_Ballisticskill.TabIndex = 8;
            this.required_Ballisticskill.Text = "Ballistic skill";
            // 
            // required_Weaponskill
            // 
            this.required_Weaponskill.AutoSize = true;
            this.required_Weaponskill.Location = new System.Drawing.Point(19, 251);
            this.required_Weaponskill.Name = "required_Weaponskill";
            this.required_Weaponskill.Size = new System.Drawing.Size(68, 13);
            this.required_Weaponskill.TabIndex = 7;
            this.required_Weaponskill.Text = "Weapon skill";
            // 
            // required_Fellowship
            // 
            this.required_Fellowship.AutoSize = true;
            this.required_Fellowship.Location = new System.Drawing.Point(19, 222);
            this.required_Fellowship.Name = "required_Fellowship";
            this.required_Fellowship.Size = new System.Drawing.Size(56, 13);
            this.required_Fellowship.TabIndex = 6;
            this.required_Fellowship.Text = "Fellowship";
            // 
            // required_Willpower
            // 
            this.required_Willpower.AutoSize = true;
            this.required_Willpower.Location = new System.Drawing.Point(19, 194);
            this.required_Willpower.Name = "required_Willpower";
            this.required_Willpower.Size = new System.Drawing.Size(56, 13);
            this.required_Willpower.TabIndex = 5;
            this.required_Willpower.Text = "Will power";
            // 
            // required_Perception
            // 
            this.required_Perception.AutoSize = true;
            this.required_Perception.Location = new System.Drawing.Point(19, 161);
            this.required_Perception.Name = "required_Perception";
            this.required_Perception.Size = new System.Drawing.Size(58, 13);
            this.required_Perception.TabIndex = 4;
            this.required_Perception.Text = "Perception";
            // 
            // required_Intelligence
            // 
            this.required_Intelligence.AutoSize = true;
            this.required_Intelligence.Location = new System.Drawing.Point(22, 127);
            this.required_Intelligence.Name = "required_Intelligence";
            this.required_Intelligence.Size = new System.Drawing.Size(61, 13);
            this.required_Intelligence.TabIndex = 3;
            this.required_Intelligence.Text = "Intelligence";
            // 
            // required_Agility
            // 
            this.required_Agility.AutoSize = true;
            this.required_Agility.Location = new System.Drawing.Point(19, 95);
            this.required_Agility.Name = "required_Agility";
            this.required_Agility.Size = new System.Drawing.Size(34, 13);
            this.required_Agility.TabIndex = 2;
            this.required_Agility.Text = "Agility";
            // 
            // required_Toughness
            // 
            this.required_Toughness.AutoSize = true;
            this.required_Toughness.Location = new System.Drawing.Point(22, 68);
            this.required_Toughness.Name = "required_Toughness";
            this.required_Toughness.Size = new System.Drawing.Size(60, 13);
            this.required_Toughness.TabIndex = 1;
            this.required_Toughness.Text = "Toughness";
            // 
            // required_Strength
            // 
            this.required_Strength.AutoSize = true;
            this.required_Strength.Location = new System.Drawing.Point(22, 33);
            this.required_Strength.Name = "required_Strength";
            this.required_Strength.Size = new System.Drawing.Size(47, 13);
            this.required_Strength.TabIndex = 0;
            this.required_Strength.Text = "Strength";
            // 
            // cb_Talents
            // 
            this.cb_Talents.FormattingEnabled = true;
            this.cb_Talents.Location = new System.Drawing.Point(52, 130);
            this.cb_Talents.Name = "cb_Talents";
            this.cb_Talents.Size = new System.Drawing.Size(121, 21);
            this.cb_Talents.TabIndex = 5;
            this.cb_Talents.SelectedIndexChanged += new System.EventHandler(this.cb_Talents_SelectedIndexChanged);
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(49, 114);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(35, 13);
            this.label1.TabIndex = 6;
            this.label1.Text = "Name";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(436, 173);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(78, 13);
            this.label2.TabIndex = 7;
            this.label2.Text = "Class Required";
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(436, 271);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(72, 13);
            this.label3.TabIndex = 8;
            this.label3.Text = "Skill Required";
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(436, 364);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(83, 13);
            this.label4.TabIndex = 9;
            this.label4.Text = "Talent Required";
            // 
            // TextDescription
            // 
            this.TextDescription.Location = new System.Drawing.Point(607, 133);
            this.TextDescription.Multiline = true;
            this.TextDescription.Name = "TextDescription";
            this.TextDescription.ReadOnly = true;
            this.TextDescription.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.TextDescription.Size = new System.Drawing.Size(221, 377);
            this.TextDescription.TabIndex = 10;
            // 
            // TextClass
            // 
            this.TextClass.Location = new System.Drawing.Point(439, 189);
            this.TextClass.Name = "TextClass";
            this.TextClass.ReadOnly = true;
            this.TextClass.Size = new System.Drawing.Size(100, 20);
            this.TextClass.TabIndex = 11;
            // 
            // TextSkill
            // 
            this.TextSkill.Location = new System.Drawing.Point(439, 288);
            this.TextSkill.Name = "TextSkill";
            this.TextSkill.ReadOnly = true;
            this.TextSkill.Size = new System.Drawing.Size(100, 20);
            this.TextSkill.TabIndex = 12;
            // 
            // TextTalent
            // 
            this.TextTalent.Location = new System.Drawing.Point(439, 381);
            this.TextTalent.Name = "TextTalent";
            this.TextTalent.ReadOnly = true;
            this.TextTalent.Size = new System.Drawing.Size(100, 20);
            this.TextTalent.TabIndex = 13;
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(607, 114);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(60, 13);
            this.label5.TabIndex = 14;
            this.label5.Text = "Description";
            // 
            // button1
            // 
            this.button1.Image = ((System.Drawing.Image)(resources.GetObject("button1.Image")));
            this.button1.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
            this.button1.Location = new System.Drawing.Point(439, 524);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(54, 23);
            this.button1.TabIndex = 15;
            this.button1.Text = "Add";
            this.button1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
            this.button1.UseVisualStyleBackColor = true;
            // 
            // Talents
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(881, 590);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.TextTalent);
            this.Controls.Add(this.TextSkill);
            this.Controls.Add(this.TextClass);
            this.Controls.Add(this.TextDescription);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.cb_Talents);
            this.Controls.Add(this.grp_Attributes);
            this.Name = "Talents";
            this.Text = "Talents";
            this.Load += new System.EventHandler(this.Talents_Load);
            this.grp_Attributes.ResumeLayout(false);
            this.grp_Attributes.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.GroupBox grp_Attributes;
        private System.Windows.Forms.TextBox TextBallisticskill;
        private System.Windows.Forms.TextBox TextWeaponskill;
        private System.Windows.Forms.TextBox TextFellowship;
        private System.Windows.Forms.TextBox TextWillpower;
        private System.Windows.Forms.TextBox TextPerception;
        private System.Windows.Forms.TextBox TextIntelligence;
        private System.Windows.Forms.TextBox TextAgility;
        private System.Windows.Forms.TextBox TextToughness;
        private System.Windows.Forms.TextBox TextStrengh;
        private System.Windows.Forms.Label required_Ballisticskill;
        private System.Windows.Forms.Label required_Weaponskill;
        private System.Windows.Forms.Label required_Fellowship;
        private System.Windows.Forms.Label required_Willpower;
        private System.Windows.Forms.Label required_Perception;
        private System.Windows.Forms.Label required_Intelligence;
        private System.Windows.Forms.Label required_Agility;
        private System.Windows.Forms.Label required_Toughness;
        private System.Windows.Forms.Label required_Strength;
        private System.Windows.Forms.ComboBox cb_Talents;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.TextBox TextDescription;
        private System.Windows.Forms.TextBox TextClass;
        private System.Windows.Forms.TextBox TextSkill;
        private System.Windows.Forms.TextBox TextTalent;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.Button button1;
    }
}
0

There are 0 answers