private void btnDone_Click(object sender, EventArgs e) { try { // Ignore blank box if (tbValue.Text != "") { // Split item into value and currency string s = cbChannels.Items[cbChannels.SelectedIndex].ToString(); string[] ss = s.Split(' '); int n = (int)(float.Parse(ss[0]) * 100f); // first set the level to 0, otherwise it just adds to level m_Hopper.SetCoinLevelsByCoin(n, ss[1].ToCharArray(), 0); // now set to value m_Hopper.SetCoinLevelsByCoin(n, ss[1].ToCharArray(), Int16.Parse(tbValue.Text)); } else { MessageBox.Show("No input, channel values unaltered", "WARNING"); } } catch (Exception ex) { MessageBox.Show(ex.ToString(), "EXCEPTION"); return; } m_Hopper.UpdateData(); this.Close(); }
private void btnDone_Click(object sender, EventArgs e) { try { // now set to value in textbox (ignore blank box) if (tbValue.Text != "") { // first set the channel level to 0, otherwise it just adds to level m_Validator.SetCoinLevelsByChannel(cbChannels.SelectedIndex + 1, 0); // now set m_Validator.SetCoinLevelsByChannel(cbChannels.SelectedIndex + 1, Int16.Parse(tbValue.Text)); } else { MessageBox.Show("No input, channel values unaltered", "WARNING"); } m_Validator.UpdateData(); } catch (Exception ex) { MessageBox.Show(ex.ToString(), "EXCEPTION"); return; } this.Close(); }