ERLEDIGT
JA
JA
ANTWORTEN
1
1
ZUGRIFFE
619
619
EMPFEHLEN
-
Hallo leute

Ich übe mich mal wieder ein bischen in c# und stoße schon wieder auf Probleme !
Ich möchte ein kleines Faxberechnungsprogramm schreiben, wo ich an Hand einer ComboBox ( Die ist mit Zeitzohnen befüllt ) und der Eingabe von Minuten eine Berechnung durchführe. D.h. Nehmen wir Deutschland: Alle 12 Sekunden bezahlt der Kunde 0,15 Cent.
Meine Frage ist:
Wie übergebe ich die Zeitzohne und die Angabe an Minuten an das vorhandene Label und rechne nun z.b. Deutschland: (Minuten * 60 (um Sekunden zu bekommen!!) ) / 12 * 0,15
PS. Ich hab noch ein Button: Gebühren berechnen *gg* Mein Code :
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; namespace faxberechnung { /// <summary> /// Zusammenfassung für Form1. /// </summary> public class Fax : System.Windows.Forms.Form { private System.Windows.Forms.GroupBox grpb1; public System.Windows.Forms.ComboBox cmb; private System.Windows.Forms.GroupBox time; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button button1; private System.Windows.Forms.Label label1; /// <summary> /// Erforderliche Designervariable. /// </summary> private System.ComponentModel.Container components = null; public Fax() { // // Erforderlich für die Windows Form-Designerunterstützung // InitializeComponent(); } /// <summary> /// Die verwendeten Ressourcen bereinigen. /// </summary> protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Vom Windows Form-Designer generierter Code /// <summary> /// Erforderliche Methode für die Designerunterstützung. /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. /// </summary> private void InitializeComponent() { this.grpb1 = new System.Windows.Forms.GroupBox(); this.cmb = new System.Windows.Forms.ComboBox(); this.time = new System.Windows.Forms.GroupBox(); this.textBox1 = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.label1 = new System.Windows.Forms.Label(); this.grpb1.SuspendLayout(); this.time.SuspendLayout(); this.SuspendLayout(); // // grpb1 // this.grpb1.Controls.Add(this.cmb); this.grpb1.Location = new System.Drawing.Point(8, 8); this.grpb1.Name = "grpb1"; this.grpb1.Size = new System.Drawing.Size(216, 64); this.grpb1.TabIndex = 1; this.grpb1.TabStop = false; this.grpb1.Text = "(1) Land"; // // cmb // this.cmb.Items.AddRange(new object[] { "Deutschland", "Euro 1", "Euro2", "Restliche Länder", "Usa & Kannada"}); this.cmb.Location = new System.Drawing.Point(16, 24); this.cmb.Name = "cmb"; this.cmb.Size = new System.Drawing.Size(192, 21); this.cmb.Sorted = true; this.cmb.TabIndex = 0; this.cmb.Text = "Bitte Land wählen..."; this.cmb.SelectedIndexChanged += new System.EventHandler(this.cmb_SelectedIndexChanged); // // time // this.time.Controls.Add(this.textBox1); this.time.Location = new System.Drawing.Point(8, 80); this.time.Name = "time"; this.time.Size = new System.Drawing.Size(216, 72); this.time.TabIndex = 2; this.time.TabStop = false; this.time.Text = "(2) Zeitangabe in MIN"; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(16, 32); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(184, 20); this.textBox1.TabIndex = 0; this.textBox1.Text = "Bitte hier die Zeit eintragen"; this.textBox1.Click += new System.EventHandler(this.textBox1_Click); // // button1 // this.button1.Location = new System.Drawing.Point(232, 16); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(192, 23); this.button1.TabIndex = 4; this.button1.Text = "(3) Gebühren berechnen..."; this.button1.Click += new System.EventHandler(this.button1_Click); // // label1 // this.label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.label1.Location = new System.Drawing.Point(232, 48); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(192, 120); this.label1.TabIndex = 5; // // Fax // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.BackColor = System.Drawing.SystemColors.ActiveBorder; this.ClientSize = new System.Drawing.Size(442, 186); this.Controls.Add(this.label1); this.Controls.Add(this.time); this.Controls.Add(this.grpb1); this.Controls.Add(this.button1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.Name = "Fax"; this.Text = "Faxberechnung"; this.grpb1.ResumeLayout(false); this.time.ResumeLayout(false); this.ResumeLayout(false); } #endregion /// <summary> /// Der Haupteinstiegspunkt für die Anwendung. /// </summary> [STAThread] static void Main() { Application.Run(new Fax()); } private void textBox1_Click(object sender, System.EventArgs e) { this.textBox1.Text =""; } private void cmb_SelectedIndexChanged(object sender, System.EventArgs e) { string first = cmb.SelectedText.ToString(); } private void button1_Click(object sender, System.EventArgs e) { this.button1.Text =""; } } }
Nun noch folgenses Problem: Der Berechnungscode verändert sich andauernd:
Euro 1: geteilt durch 7,2 mal 0,15
Euro 2: /5,63 * 0,15
u.s.w.
Ich bedanke mich jetzt schon im vorraus.
MFG
axelfxxx
-
hat sich schon erledigt
)
hier der Code:
Code :1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
try { string first = cmb.SelectedItem.ToString(); double minute = Convert.ToDouble(text.Text); double de = minute * 60 / 12 * 0.15 + 1.5; double eu1 = minute * 60 / 7.2 * 0.15 + 1.5; double eu2 = minute * 60 / 5.63 * 0.15 + 1.5; double usa = minute * 60 / 5 * 0.15 + 1.5; double res = minute * 60 / 2.31 * 0.15 + 1.5; if (first.Equals("Deutschland")) { this.label1.Text = "Sie faxten in Zeitzohne: " + first + " für " + "\n" + de + " Euro inkl. Grundgebühr für die erste Seite"; this.info.Text = "Deutschland: Alle 12 Sekunden 0,15 Euro !"; } else if(first.Equals("Euro 1")) { this.label1.Text = "Sie faxten in Zeitzohne: " + first + " für " + "\n" + eu1 + " Euro inkl. Grundgebühr für die erste Seite"; this.info.Text = "Euro 1: Alle 7,2 Sekunden 0,15 Euro !"; } else if(first.Equals("Euro 2")) { this.label1.Text = "Sie faxten in Zeitzohne: " + first + " für " + "\n" + eu2 + " Euro inkl. Grundgebühr für die erste Seite"; this.info.Text = "Euro 2: Alle 5,63 Sekunden 0,15 Euro !"; } else if(first.Equals("USA & Cannada")) { this.label1.Text = "Sie faxten in Zeitzohne: " + first + " für " + "\n" + usa + " Euro inkl. Grundgebühr für die erste Seite"; this.info.Text = "USA & Cannada: Alle 5 Sekunden 0,15 Euro !"; } else if(first.Equals("Restliche Länder")) { this.label1.Text = "Sie faxten in Zeitzohne: " + first + " für " + "\n" + res + " Euro inkl. Grundgebühr für die erste Seite"; this.info.Text = "Restliche Länder: Alle 2,31 Sekunden 0,15 Euro !"; } else MessageBox.Show("Bitte irgendwas eingebnen"); } catch(System.NullReferenceException) { MessageBox.Show("Bitte nicht vergessen das Land einzugeben !!", "Eingabefehler"); } catch(System.FormatException) { MessageBox.Show("Biite eine Minuteneingabe nicht vergessen !!", "Eingabefehler"); } }
Ähnliche Themen
-
Access, ComboBox gemäß ComboBox füllen?
Von pglw im Forum Relationale DatenbanksystemeAntworten: 1Letzter Beitrag: 17.09.06, 22:08 -
SQL-Problemchen
Von prince-simo im Forum Relationale DatenbanksystemeAntworten: 1Letzter Beitrag: 24.07.06, 19:43 -
SQL Problemchen !?
Von svennson im Forum PHPAntworten: 2Letzter Beitrag: 15.06.05, 12:39 -
Problemchen!
Von svennson im Forum PHPAntworten: 7Letzter Beitrag: 08.06.05, 14:31 -
Problemchen
Von qube im Forum PHPAntworten: 9Letzter Beitrag: 13.05.05, 15:13





Zitieren
Login





