//gen char panel public Panel genCharPanel(int rowNum) { UserSavedCharacterData temp = (UserSavedCharacterData)usrSavedCharacterData.userCharList[rowNum]; //[Char Panel] Panel charPanel = new Panel(); charPanel.Size = new Size(947, 253); //882, 253 //947, 253 charPanel.BorderStyle = BorderStyle.FixedSingle; //[Del Char Record Button] Button delCharRecButton = new Button(); delCharRecButton.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold); delCharRecButton.ForeColor = System.Drawing.Color.Crimson; delCharRecButton.AutoSize = true; delCharRecButton.Text = "❌"; delCharRecButton.Size = new Size(35, 27); delCharRecButton.Location = new Point(898, 12); //833, 12 delCharRecButton.MouseClick += delegate { DialogResult result = MessageBox.Show("Delete Character Record?", "Confirmation", MessageBoxButtons.YesNoCancel); //YesNoCancel -> YesNo if (result == DialogResult.Yes) { //... usrSavedCharacterData.delCharRecord(User.userID, temp.charID); initializeTable(User.userID); //Refresh } else if (result == DialogResult.No) { //... return; } else { //... return; } }; //[Name Label] Label nameLabel = new Label(); nameLabel.Location = new Point(8, 221); //12, 221 nameLabel.AutoSize = true; //nameLabel.Text = "NAME"; nameLabel.Font = new Font("Impact", 14); nameLabel.Text = temp.Name; //[Large Photo (Char)] PictureBox pctbxChar = new PictureBox(); pctbxChar.Size = new Size(112, 200); //pctbx.SizeMod pctbxChar.Location = new Point(12, 12); pctbxChar.SizeMode = PictureBoxSizeMode.Zoom; //Zoom not StretchImage to keep aspect ratio //pctbx.SizeMode = PictureBoxSizeMode.AutoSize; pctbxChar.ImageLocation = temp.imgURLchar; //[Talent PictureBoxes] PictureBox pctbxT1 = new PictureBox(); PictureBox pctbxT2 = new PictureBox(); PictureBox pctbxT3 = new PictureBox(); pctbxT1.Size = new Size(50, 50); pctbxT2.Size = new Size(50, 50); pctbxT3.Size = new Size(50, 50); pctbxT1.Location = new Point(130, 12); //300, 12 pctbxT2.Location = new Point(130, 68); pctbxT3.Location = new Point(130, 124); pctbxT1.SizeMode = PictureBoxSizeMode.Zoom; pctbxT2.SizeMode = PictureBoxSizeMode.Zoom; pctbxT3.SizeMode = PictureBoxSizeMode.Zoom; pctbxT1.ImageLocation = temp.imgURLt1; pctbxT2.ImageLocation = temp.imgURLt2; pctbxT3.ImageLocation = temp.imgURLt3; //[Talent Labels] Label t1Label = new Label(); Label t2Label = new Label(); Label t3Label = new Label(); t1Label.AutoSize = true; t2Label.AutoSize = true; t3Label.AutoSize = true; t1Label.Font = new Font("Impact", 14); t2Label.Font = new Font("Impact", 14); t3Label.Font = new Font("Impact", 14); t1Label.Location = new Point(182, 12); t2Label.Location = new Point(182, 68); t3Label.Location = new Point(182, 124); t1Label.Text = temp.talent1Name; t2Label.Text = temp.talent2Name; t3Label.Text = temp.talent3Name; //[Weapon Controls Logic] #region [addWeapon Controls + Functionality] //Dropdown (ComboBox) for weapon select ComboBox wpcbbx = new ComboBox(); wpcbbx.Font = new Font("Arial", 11); //set datasource to chars list; //cbbx.DataSource //cbbx.Items.Add([Select Character]"}); //wpcbbx.Text = "Select Weapon"; wpcbbx.Width = 195; //212, 21 wpcbbx.Visible = false; //POSITION NEEDS TO BE SET wpcbbx.Location = new Point(698, 47); //633, 47 wpcbbx.DropDownStyle = ComboBoxStyle.DropDownList; //[Add Weapon Button Logic] Button addWeapon = new Button(); addWeapon.Size = new Size(35, 27); //96, 29 addWeapon.Location = new Point(698, 12); //633, 12 //toggleCalc.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold); addWeapon.AutoSize = true; addWeapon.Text = "Add Weapon"; //addWeapon.Visible = false; //Maybe Not Needed?, check visibility section below... addWeapon.Visible = true; //[Add Weapon Save/Cancel Button] Button addWeaponSave = new Button(); Button addWeaponCancel = new Button(); addWeaponSave.Size = new Size(88, 24); addWeaponSave.Location = new Point(698, 74); //633, 74 //addWeaponSave.AutoSize = true; addWeaponSave.Text = "Save"; addWeaponCancel.Size = new Size(88, 24); addWeaponCancel.Location = new Point(791, 74); //735, 74 //726, 74 //addWeaponCancel.AutoSize = true; addWeaponCancel.Text = "Cancel"; addWeaponSave.Visible = false; addWeaponCancel.Visible = false; //[Delete Weapon] Button delWeapon = new Button(); delWeapon.Size = new Size(35, 27); //96, 29 delWeapon.Location = new Point(687, 12); //633, 12 //622, 12 //toggleCalc.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold); delWeapon.AutoSize = true; delWeapon.Text = "Delete Weapon"; delWeapon.Visible = false; //Maybe Not Needed?, check visibility section below... //[Weapon Controls Visibility Logic] if (temp.wepID == -1) { addWeapon.Visible = true; delWeapon.Visible = false; } else { addWeapon.Visible = false; delWeapon.Visible = true; //function get wepInfo? dbWeaponsList.getWeaponData(temp.wepID); dbWeapon tempWep = (dbWeapon)dbWeaponsList.userCharWeaponData[0]; //[Weapon Display Items] Label wepNameLabel = new Label(); wepNameLabel.AutoSize = true; wepNameLabel.Font = new Font("Impact", 14); wepNameLabel.Location = new Point(684, 47); //619, 47 wepNameLabel.Text = tempWep.name; //wepNameLabel.Visible = true; PictureBox pctbxWEP = new PictureBox(); pctbxWEP.Size = new Size(100, 100); pctbxWEP.Location = new Point(684, 74); //619, 74 pctbxWEP.SizeMode = PictureBoxSizeMode.Zoom; pctbxWEP.ImageLocation = tempWep.imgURL; charPanel.Controls.Add(wepNameLabel); charPanel.Controls.Add(pctbxWEP); } addWeapon.MouseClick += delegate { wpcbbx.Visible = true; addWeaponSave.Visible = true; addWeaponCancel.Visible = true; //Add Weapons To CBBX wpcbbx.Items.Clear(); string dText = "Select Weapon"; wpcbbx.Items.Insert(0, dText); wpcbbx.SelectedIndex = 0; Console.WriteLine("SELECTEDITEM: " + wpcbbx.SelectedItem); wpcbbx.MouseClick += delegate { if (wpcbbx.SelectedIndex == 0 && wpcbbx.SelectedItem == dText) { wpcbbx.Items.RemoveAt(0); } }; wpcbbx.Leave += delegate { Console.WriteLine("SELECTEDINDEX LEAVE: " + wpcbbx.SelectedIndex); Console.WriteLine("SELECTEDITEM LEAVE: " + wpcbbx.SelectedItem); if (wpcbbx.SelectedIndex == 0 && wpcbbx.SelectedItem == "") { wpcbbx.Items.Insert(0, dText); wpcbbx.SelectedIndex = 0; } }; int listCount = 1; for (int i = 1; i < dbWeaponsList.dbWepList.Count; i++) { dbWeapon tempWep = (dbWeapon)dbWeaponsList.dbWepList[i]; //UserSavedCharacterData temp = (UserSavedCharacterData)usrSavedCharacterData.addNewCharList[i]; //wpcbbx.Items.Add(i + 1 + ". " + tempWep.name); if (temp.weaponType == tempWep.wepType) //List Correct Weapon Types for ea character { wpcbbx.Items.Add(listCount + ". " + tempWep.name); listCount++; } } }; addWeaponSave.MouseClick += delegate { //Visibility addWeapon.Visible = false; wpcbbx.Visible = false; addWeaponSave.Visible = false; addWeaponCancel.Visible = false; delWeapon.Visible = true; //Maybe not needed... //[Function Call] //[Get Actual wepID of wep in DB] //Possibly a better way to do this, char is like this above, in addNewChar string wepName = (string)wpcbbx.SelectedItem; wepName = wepName.Substring(wepName.IndexOf(" ") + 1); Console.WriteLine("wepName: " + wepName); int actualWepID = -1; for (int i = 0; i < dbWeaponsList.dbWepList.Count; i++) { dbWeapon tempWep = (dbWeapon)dbWeaponsList.dbWepList[i]; if (wepName == tempWep.name) //List Correct Weapon Types for ea character { Console.WriteLine("SELECTEDITEM IF STATMENT: " + wpcbbx.SelectedItem); actualWepID = tempWep.wepID; } } //int actualWepID = wpcbbx.SelectedIndex.; Console.WriteLine("actualWepID: " + actualWepID); //Call Function to add charWep to User Records usrSavedCharacterData.addCharWeaponRecord(User.userID, temp.charID, actualWepID); //Refresh initializeTable(User.userID); //Refresh }; addWeaponCancel.MouseClick += delegate { //Visibility addWeapon.Visible = true; wpcbbx.Visible = false; addWeaponSave.Visible = false; addWeaponCancel.Visible = false; //Function Call? }; delWeapon.MouseClick += delegate { /* * //PROBABLY NOT NEEDED * wpcbbx.Visible = true; * addWeaponSave.Visible = true; * addWeaponCancel.Visible = true;*/ //Function Call DialogResult result = MessageBox.Show("Delete Character's Weapon Record?", "Confirmation", MessageBoxButtons.YesNoCancel); //YesNoCancel -> YesNo if (result == DialogResult.Yes) { //... usrSavedCharacterData.delCharWeaponRecord(User.userID, temp.charID); initializeTable(User.userID); //Refresh } else if (result == DialogResult.No) { //... return; } else { //... return; } //call db set back to -1 //Refresh //initializeTable(User.userID); //Refresh }; #endregion //(Enable/Disable) Toggle Calculation Button #region [Toggle Calculation Buttons] Button toggleCalc = new Button(); toggleCalc.Size = new Size(35, 27); toggleCalc.Location = new Point(782, 12); //717, 12 //toggleCalc.Font = new Font("Microsoft Sans Serif", 10, FontStyle.Bold); toggleCalc.AutoSize = true; toggleCalc.Text = "Enable Calculations"; if (temp.toggleCalc == 1) //toggleCalc Enabled { //Move Other Elements //Call Calc Function toggleCalc.Text = "Disable Calculations"; /*toggleCalc.MouseClick += delegate * { * * };*/ //addWeapon.Visible = true; //Probably redundant, look above... //[Controls for Calc] NumericUpDown numBoxCharLevel = new NumericUpDown(); numBoxCharLevel.Name = "charLevel"; numBoxCharLevel.Width = 50; numBoxCharLevel.Location = new Point(186, 221); //130, 192 numBoxCharLevel.Value = temp.charLevel; //INITIAL VALUE NumericUpDown numBoxCharLevelDesired = new NumericUpDown(); numBoxCharLevelDesired.Name = "charDesiredLevel"; numBoxCharLevelDesired.Width = 50; numBoxCharLevelDesired.Location = new Point(242, 221); numBoxCharLevelDesired.Value = temp.charDesiredLevel; //INITIAL VALUE NumericUpDown numBoxT1Level = new NumericUpDown(); numBoxT1Level.Name = "t1Level"; numBoxT1Level.Width = 50; numBoxT1Level.Location = new Point(186, 42); numBoxT1Level.Value = temp.t1Level; //INITIAL VALUE NumericUpDown numBoxT1LevelDesired = new NumericUpDown(); numBoxT1LevelDesired.Name = "t1DesiredLevel"; numBoxT1LevelDesired.Width = 50; numBoxT1LevelDesired.Location = new Point(242, 42); numBoxT1LevelDesired.Value = temp.t1DesiredLevel; //INITIAL VALUE NumericUpDown numBoxT2Level = new NumericUpDown(); numBoxT2Level.Name = "t2Level"; numBoxT2Level.Width = 50; numBoxT2Level.Location = new Point(186, 98); numBoxT2Level.Value = temp.t2Level; //INITIAL VALUE NumericUpDown numBoxT2LevelDesired = new NumericUpDown(); numBoxT2LevelDesired.Name = "t2DesiredLevel"; numBoxT2LevelDesired.Width = 50; numBoxT2LevelDesired.Location = new Point(242, 98); numBoxT2LevelDesired.Value = temp.t2DesiredLevel; //INITIAL VALUE NumericUpDown numBoxT3Level = new NumericUpDown(); numBoxT3Level.Name = "t3Level"; numBoxT3Level.Width = 50; numBoxT3Level.Location = new Point(186, 154); numBoxT3Level.Value = temp.t3Level; //INITIAL VALUE NumericUpDown numBoxT3LevelDesired = new NumericUpDown(); numBoxT3LevelDesired.Name = "t3DesiredLevel"; numBoxT3LevelDesired.Width = 50; numBoxT3LevelDesired.Location = new Point(242, 154); numBoxT3LevelDesired.Value = temp.t3DesiredLevel; //INITIAL VALUE if (temp.wepID != -1) { NumericUpDown numBoxWepLevel = new NumericUpDown(); numBoxWepLevel.Name = "wepLevel"; numBoxWepLevel.Width = 50; numBoxWepLevel.Location = new Point(684, 221); //725, 74 //619, 221 numBoxWepLevel.Value = temp.wepLevel; //INITIAL VALUE NumericUpDown numBoxWepLevelDesired = new NumericUpDown(); numBoxWepLevelDesired.Name = "wepDesiredLevel"; numBoxWepLevelDesired.Width = 50; numBoxWepLevelDesired.Location = new Point(740, 221); //781, 74 //675, 221 numBoxWepLevelDesired.Value = temp.wepDesiredLevel; //INITIAL VALUE numBoxWepLevel.ValueChanged += delegate { int flag = usrSavedCharacterData.updateLevel(User.userID, temp.charID, numBoxWepLevel.Name, numBoxWepLevelDesired.Name, (int)numBoxWepLevel.Value, (int)numBoxWepLevelDesired.Value); if (flag == 0) { numBoxWepLevelDesired.Value += 1; numBoxWepLevel.Value = numBoxWepLevelDesired.Value; } }; numBoxWepLevelDesired.ValueChanged += delegate { int flag = usrSavedCharacterData.updateLevel(User.userID, temp.charID, numBoxWepLevel.Name, numBoxWepLevelDesired.Name, (int)numBoxWepLevel.Value, (int)numBoxWepLevelDesired.Value); if (flag == 0) { numBoxWepLevel.Value = numBoxWepLevelDesired.Value; } }; /*FlowLayoutPanel flp_wepMaterialPanel = new FlowLayoutPanel(); * SetDoubleBuffered(flp_wepMaterialPanel); * flp_wepMaterialPanel.Size = new Size(139, 164); * flp_wepMaterialPanel.Location = new Point(796, 74); //731, 74 * flp_wepMaterialPanel.WrapContents = true;*/ //call function to get contents? //[Set Min/Max Values & Add Controls] numBoxWepLevel.Minimum = 1; numBoxWepLevel.Maximum = 90; numBoxWepLevelDesired.Minimum = 1; numBoxWepLevelDesired.Maximum = 90; charPanel.Controls.Add(numBoxWepLevel); charPanel.Controls.Add(numBoxWepLevelDesired); //charPanel.Controls.Add(flp_wepMaterialPanel); } //[Set Min/Max Values & Add Controls] numBoxCharLevel.Minimum = 1; numBoxCharLevel.Maximum = 90; numBoxCharLevelDesired.Minimum = 1; numBoxCharLevelDesired.Maximum = 90; numBoxT1Level.Minimum = 1; numBoxT1Level.Maximum = 10; numBoxT1LevelDesired.Minimum = 1; numBoxT1LevelDesired.Maximum = 10; numBoxT2Level.Minimum = 1; numBoxT2Level.Maximum = 10; numBoxT2LevelDesired.Minimum = 1; numBoxT2LevelDesired.Maximum = 10; numBoxT3Level.Minimum = 1; numBoxT3Level.Maximum = 10; numBoxT3LevelDesired.Minimum = 1; numBoxT3LevelDesired.Maximum = 10; /*FlowLayoutPanel flp_charMaterialPanel = new FlowLayoutPanel(); * SetDoubleBuffered(flp_charMaterialPanel); * flp_charMaterialPanel.Size = new Size(357, 203); //311, 203 * flp_charMaterialPanel.Location = new Point(322, 35); * flp_charMaterialPanel.WrapContents = true; * flp_charMaterialPanel.AutoScroll = true;*/ //[genCalc Functions] int purplesNeeded = genCalc.calcRangesEXPTablePurples((int)numBoxCharLevel.Value, (int)numBoxCharLevelDesired.Value); usrSavedInventoryData.getUserInvEXPBooks(User.userID); int numPurples = 0; int numBlues = 0; int numGreens = 0; for (int i = 0; i <= 2; i++) { UserSavedInventoryData invBooks = (UserSavedInventoryData)usrSavedInventoryData.userInvEXPBooks[i]; if (i == 0) { numGreens = invBooks.count; } if (i == 1) { numBlues = invBooks.count; } if (i == 2) { numPurples = invBooks.count; } } Console.WriteLine("form1 - BOOKS: purple " + numPurples + " blue " + numBlues + " green " + numGreens); int[] bookArray = genCalc.calcEXPBookDistribution(purplesNeeded, numPurples, numBlues, numGreens); //generateCharMaterialItemPanel(bookArray,); /*flp_charMaterialPanel.Controls.Add(generateItemPanel(2)); * flp_charMaterialPanel.Controls.Add(generateItemPanel(1)); * flp_charMaterialPanel.Controls.Add(generateItemPanel(0)); * flp_charMaterialPanel.Controls.Add(generateItemPanel(temp.ascElementalMat)); * flp_charMaterialPanel.Controls.Add(generateItemPanel(temp.ascElementalBossMat));*/ //[Add onValueChanged Events] numBoxCharLevel.ValueChanged += delegate { int flag = usrSavedCharacterData.updateLevel(User.userID, temp.charID, numBoxCharLevel.Name, numBoxCharLevelDesired.Name, (int)numBoxCharLevel.Value, (int)numBoxCharLevelDesired.Value); if (flag == 0) { numBoxCharLevelDesired.Value += 1; numBoxCharLevel.Value = numBoxCharLevelDesired.Value; } }; numBoxCharLevelDesired.ValueChanged += delegate { int flag = usrSavedCharacterData.updateLevel(User.userID, temp.charID, numBoxCharLevel.Name, numBoxCharLevelDesired.Name, (int)numBoxCharLevel.Value, (int)numBoxCharLevelDesired.Value); if (flag == 0) { numBoxCharLevel.Value = numBoxCharLevelDesired.Value; } }; numBoxT1Level.ValueChanged += delegate { int flag = usrSavedCharacterData.updateLevel(User.userID, temp.charID, numBoxT1Level.Name, numBoxT1LevelDesired.Name, (int)numBoxT1Level.Value, (int)numBoxT1LevelDesired.Value); if (flag == 0) { numBoxT1LevelDesired.Value += 1; numBoxT1Level.Value = numBoxT1LevelDesired.Value; } }; numBoxT1LevelDesired.ValueChanged += delegate { int flag = usrSavedCharacterData.updateLevel(User.userID, temp.charID, numBoxT1Level.Name, numBoxT1LevelDesired.Name, (int)numBoxT1Level.Value, (int)numBoxT1LevelDesired.Value); if (flag == 0) { numBoxT1Level.Value = numBoxT1LevelDesired.Value; } }; numBoxT2Level.ValueChanged += delegate { int flag = usrSavedCharacterData.updateLevel(User.userID, temp.charID, numBoxT2Level.Name, numBoxT2LevelDesired.Name, (int)numBoxT2Level.Value, (int)numBoxT2LevelDesired.Value); if (flag == 0) { numBoxT2LevelDesired.Value += 1; numBoxT2Level.Value = numBoxT2LevelDesired.Value; } }; numBoxT2LevelDesired.ValueChanged += delegate { int flag = usrSavedCharacterData.updateLevel(User.userID, temp.charID, numBoxT2Level.Name, numBoxT2LevelDesired.Name, (int)numBoxT2Level.Value, (int)numBoxT2LevelDesired.Value); if (flag == 0) { numBoxT2Level.Value = numBoxT2LevelDesired.Value; } }; numBoxT3Level.ValueChanged += delegate { int flag = usrSavedCharacterData.updateLevel(User.userID, temp.charID, numBoxT3Level.Name, numBoxT3LevelDesired.Name, (int)numBoxT3Level.Value, (int)numBoxT3LevelDesired.Value); if (flag == 0) { numBoxT3LevelDesired.Value += 1; numBoxT3Level.Value = numBoxT3LevelDesired.Value; } }; numBoxT3LevelDesired.ValueChanged += delegate { int flag = usrSavedCharacterData.updateLevel(User.userID, temp.charID, numBoxT3Level.Name, numBoxT3LevelDesired.Name, (int)numBoxT3Level.Value, (int)numBoxT3LevelDesired.Value); if (flag == 0) { numBoxT3Level.Value = numBoxT3LevelDesired.Value; } }; //[Add Controls] charPanel.Controls.Add(numBoxCharLevel); charPanel.Controls.Add(numBoxCharLevelDesired); charPanel.Controls.Add(numBoxT1Level); charPanel.Controls.Add(numBoxT1LevelDesired); charPanel.Controls.Add(numBoxT2Level); charPanel.Controls.Add(numBoxT2LevelDesired); charPanel.Controls.Add(numBoxT3Level); charPanel.Controls.Add(numBoxT3LevelDesired); //charPanel.Controls.Add(flp_charMaterialPanel); } else //toggleCalc Disabled { //Move Other Elements toggleCalc.Text = "Enable Calculations"; /*toggleCalc.MouseClick += delegate * { * };*/ //addWeapon.Visible = false; //Not redundant... Look above... } int nextValue = temp.toggleCalc; toggleCalc.MouseClick += delegate { Console.WriteLine("NEXTVALUE: " + nextValue); nextValue = updateToggleCalc(User.userID, temp.charID, nextValue); if (nextValue == 1) //Enabled { //toggleCalc.Text = "Disable Calculations"; //addWeapon.Visible = true; //Not redundant... Look above... //Refresh initializeTable(User.userID); //Refresh } else //Disabled { //toggleCalc.Text = "Enable Calculations"; //addWeapon.Visible = false; //Not redundant... Look above... //Refresh initializeTable(User.userID); //Refresh } }; #endregion //[Adding Controls To Panel] #region [charPanel.Controls.Add(...)] //[Add Controls] charPanel.Controls.Add(delCharRecButton); charPanel.Controls.Add(nameLabel); charPanel.Controls.Add(pctbxChar); //[PictureBoxTalents] charPanel.Controls.Add(pctbxT1); charPanel.Controls.Add(pctbxT2); charPanel.Controls.Add(pctbxT3); //[Talent Name Labels] charPanel.Controls.Add(t1Label); charPanel.Controls.Add(t2Label); charPanel.Controls.Add(t3Label); //[Toggle CalcButton] charPanel.Controls.Add(toggleCalc); //[Weapon Controls (addWeapon)] charPanel.Controls.Add(addWeapon); charPanel.Controls.Add(wpcbbx); charPanel.Controls.Add(addWeaponSave); charPanel.Controls.Add(addWeaponCancel); charPanel.Controls.Add(delWeapon); #endregion return(charPanel); }
public FlowLayoutPanel genAddNewPanel() { FlowLayoutPanel addNewPanel = new FlowLayoutPanel(); //addNewPanel.Size = new Size(882, 253); //addNewPanel.Width = 882; //addNewPanel.AutoSize = true; addNewPanel.Width = 947; //882 addNewPanel.BorderStyle = BorderStyle.FixedSingle; Button addNewButton = new Button(); addNewButton.Text = "Add New Character"; addNewButton.AutoSize = true; //Buton/Panel Height/Positioning addNewPanel.Height = addNewButton.Height.GetHashCode() + 15; //addNewButton.Location = new Point(3, 3); addNewPanel.Padding = new Padding(3, 3, 3, 3); //ComboBox + Save Button ComboBox cbbx = new ComboBox(); cbbx.Font = new Font("Arial", 11); //set datasource to chars list; //cbbx.DataSource //cbbx.Items.Add([Select Character]"}); //cbbx.Text = "Select Character"; SEE BELOW >>//CBBX Default Text (Post-Uneditable Change)<< cbbx.Width = 250; cbbx.DropDownStyle = ComboBoxStyle.DropDownList; Button addNewSaveButton = new Button(); addNewSaveButton.Text = "Add"; addNewSaveButton.AutoSize = true; Button addNewCancelButton = new Button(); addNewCancelButton.Text = "Cancel"; addNewCancelButton.AutoSize = true; cbbx.Visible = false; addNewSaveButton.Visible = false; addNewCancelButton.Visible = false; //[OnClick Events] addNewButton.MouseClick += delegate { addNewButton.Visible = false; cbbx.Visible = true; addNewSaveButton.Visible = true; addNewCancelButton.Visible = true; usrSavedCharacterData.getUserAddNewCharList(User.userID); cbbx.Items.Clear(); //Clear here & in Function Above ^ //CBBX Default Text (Post-Uneditable Change) string dText = "Select Character"; cbbx.Items.Insert(0, dText); //cbbx.Items[9999] = "Select Character"; //cbbx.Items.Add("Select Character"); cbbx.SelectedIndex = 0; Console.WriteLine("SELECTEDITEM: " + cbbx.SelectedItem); //Console.WriteLine("selectedvalue: " + cbbx.SelectedValue); <<This returns nothing... cbbx.MouseClick += delegate { if (cbbx.SelectedIndex == 0 && cbbx.SelectedItem == dText) { cbbx.Items.RemoveAt(0); } }; cbbx.Leave += delegate { Console.WriteLine("SELECTEDINDEX LEAVE: " + cbbx.SelectedIndex); Console.WriteLine("SELECTEDITEM LEAVE: " + cbbx.SelectedItem); if (cbbx.SelectedIndex == 0 && cbbx.SelectedItem == "") { cbbx.Items.Insert(0, dText); cbbx.SelectedIndex = 0; } }; for (int i = 0; i < usrSavedCharacterData.addNewCharList.Count; i++) { UserSavedCharacterData temp = (UserSavedCharacterData)usrSavedCharacterData.addNewCharList[i]; cbbx.Items.Add(i + 1 + ". " + temp.Name); } //cbbx.DataSource = usrSavedCharacterData.addNewCharList; //cbbx.Dat }; addNewSaveButton.MouseClick += delegate { //[Get Actual charID of char in DB] //Possibly a better way to do this int charIndex = cbbx.SelectedIndex; int actualcharID = -1; for (int i = 0; i < usrSavedCharacterData.addNewCharList.Count; i++) { UserSavedCharacterData temp = (UserSavedCharacterData)usrSavedCharacterData.addNewCharList[i]; if (charIndex == i) { actualcharID = temp.charID; } } Console.WriteLine("ACTUALCHARID: " + actualcharID); // //Call Function to add character to User Records usrSavedCharacterData.addCharRecord(User.userID, actualcharID); //Refresh Table initializeTable(User.userID); }; addNewCancelButton.MouseClick += delegate { addNewButton.Visible = true; cbbx.Visible = false; addNewSaveButton.Visible = false; addNewCancelButton.Visible = false; }; addNewPanel.Controls.Add(addNewButton); addNewPanel.Controls.Add(cbbx); addNewPanel.Controls.Add(addNewSaveButton); addNewPanel.Controls.Add(addNewCancelButton); return(addNewPanel); }