| Autor |
Beitrag |
Kracker
      
Beiträge: 19
|
Verfasst: Di 24.05.11 08:28
Hallo,
ich bin gerade dabei einen TaschenRechner zu programmieren, und seit einem Tag kommt wenn ich einen Debug starte, nur ein leeres Fenster.
Im angehängten Bil dist das gut zu erkennen....
Einloggen, um Attachments anzusehen!
|
|
FURIOS
      
Beiträge: 42
Windoof 7
~~~>* C# *<~~~
|
Verfasst: Di 24.05.11 08:30
vllt liegt es daran das du eine zweite Form erstellt hast und wenn du debbugst, das sich dann die zweite Form öffnet?!
_________________ Nicht wer viel hat, sondern wer wenig will ist glücklich !*
|
|
Kracker 
      
Beiträge: 19
|
Verfasst: Di 24.05.11 08:36
also im Projektmappen-Ordner steht nur die Form1 drin....
|
|
FURIOS
      
Beiträge: 42
Windoof 7
~~~>* C# *<~~~
|
Verfasst: Di 24.05.11 08:39
Anders kann ich es mir auch nicht erklären ....
Also wenn ich du wäre , würde ich den ganzen code kopieren und in eine neue WinForm einfügen
selbstverständlich mit dem ganzen Zeugs in der Form
FURIOS 
_________________ Nicht wer viel hat, sondern wer wenig will ist glücklich !*
|
|
FURIOS
      
Beiträge: 42
Windoof 7
~~~>* C# *<~~~
|
Verfasst: Di 24.05.11 08:42
oder um zu überprüfen ob du wirklich keine zweite leere Form erstellt hast, erstell doch jetzt mal eine neue Form und schau nach ob nach der ertsten Form sofort die zweite kommt die du erstellt hast oder ob die 3te Form erscheind
so könntest du es überprüfen.
_________________ Nicht wer viel hat, sondern wer wenig will ist glücklich !*
|
|
Kracker 
      
Beiträge: 19
|
Verfasst: Di 24.05.11 10:05
Ich habe eine neue Form gemacht, und es war die 2e.....
Ich habe alles kopiert und in ein neues eingefügt und es ist trozdem nix gekommen, ich hab ein komplett neues Projekt gemacht um zu sehen ob es am C# liegt, aber da sind die Buttons etc. gekommen......
ich geb euch mal den Quelltext...
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: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: 434: 435: 436: 437: 438: 439: 440: 441: 442: 443: 444: 445: 446: 447: 448: 449: 450: 451: 452: 453: 454: 455: 456: 457: 458: 459: 460: 461: 462: 463: 464: 465: 466: 467: 468: 469: 470: 471: 472: 473: 474: 475: 476: 477: 478: 479: 480: 481: 482: 483: 484: 485: 486: 487: 488: 489: 490: 491: 492: 493: 494: 495: 496: 497: 498: 499: 500: 501: 502: 503: 504: 505: 506: 507: 508: 509: 510: 511: 512: 513: 514: 515: 516: 517: 518: 519: 520: 521: 522: 523: 524: 525: 526: 527: 528: 529: 530: 531: 532: 533: 534: 535: 536: 537: 538: 539: 540: 541: 542: 543: 544: 545: 546: 547: 548: 549: 550: 551: 552: 553: 554: 555: 556: 557: 558: 559: 560: 561: 562: 563: 564: 565: 566: 567: 568: 569: 570: 571: 572: 573: 574: 575: 576: 577: 578: 579: 580: 581: 582: 583: 584: 585: 586: 587: 588: 589: 590: 591: 592: 593: 594: 595: 596: 597: 598: 599: 600: 601: 602: 603: 604: 605: 606: 607: 608: 609: 610: 611: 612: 613: 614: 615: 616: 617: 618: 619: 620: 621:
| using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms;
namespace Calculator {
public partial class Form1 : Form { public decimal Ergebnis = 0; public decimal zErgebnis = 0; public decimal Operator; public decimal Zahl2 = 0; public decimal y = 0; public double Komma = 0; public int Tastatur = 0;
public void Nummer1() {
if (Komma == 0) { zErgebnis = zErgebnis * 10; zErgebnis = zErgebnis + 1; } else { zErgebnis = zErgebnis + Convert.ToDecimal(Komma); Komma = Komma / 10; } zEinschreiben(); } public void Nummer2() { if (Komma == 0) { zErgebnis = zErgebnis * 10; zErgebnis = zErgebnis + 2; } else { zErgebnis = zErgebnis + Convert.ToDecimal(2 * Komma); Komma = Komma / 10; } zEinschreiben();
} public void Nummer3() { if (Komma == 0) { zErgebnis = zErgebnis * 10; zErgebnis = zErgebnis + 3; } else { zErgebnis = zErgebnis + Convert.ToDecimal(3 * Komma); Komma = Komma / 10; } zEinschreiben(); } public void Nummer4() { if (Komma == 0) { zErgebnis = zErgebnis * 10; zErgebnis = zErgebnis + 4; } else { zErgebnis = zErgebnis + Convert.ToDecimal(4 * Komma); Komma = Komma / 10; } zEinschreiben(); } public void Nummer5() { if (Komma == 0) { zErgebnis = zErgebnis * 10; zErgebnis = zErgebnis + 5; } else { zErgebnis = zErgebnis + Convert.ToDecimal(5 * Komma); Komma = Komma / 10; } zEinschreiben(); } public void Nummer6() { if (Komma == 0) { zErgebnis = zErgebnis * 10; zErgebnis = zErgebnis + 6; } else { zErgebnis = zErgebnis + Convert.ToDecimal(6 * Komma); Komma = Komma / 10; } zEinschreiben(); } public void Nummer7() { if (Komma == 0) { zErgebnis = zErgebnis * 10; zErgebnis = zErgebnis + 7; } else { zErgebnis = zErgebnis + Convert.ToDecimal(7 * Komma); Komma = Komma / 10; } zEinschreiben(); } public void Nummer8() { if (Komma == 0) { zErgebnis = zErgebnis * 10; zErgebnis = zErgebnis + 8; } else { zErgebnis = zErgebnis + Convert.ToDecimal(8 * Komma); Komma = Komma / 10; } zEinschreiben();
} public void Nummer9() { if (Komma == 0) { zErgebnis = zErgebnis * 10; zErgebnis = zErgebnis + 9; } else { zErgebnis = zErgebnis + Convert.ToDecimal(9 * Komma); Komma = Komma / 10; } zEinschreiben();
} public void Nummer0() { if (Komma == 0) { zErgebnis = zErgebnis * 10; zErgebnis = zErgebnis + 0; } else { zErgebnis = Convert.ToDecimal(Convert.ToString(zErgebnis) + 0); Komma = Komma / 10; } zEinschreiben(); } public void Plus() { lab_Operant.Text = "+"; Zahl2 = Zahl2 + zErgebnis; zErgebnis = 0; lab_Ergebnis.Text = Convert.ToString(Zahl2);
Operator = 1; lab_zErgebnis.Text = "0"; Komma = 0; } public void Minus() { lab_Operant.Text = "-"; Zahl2 = Zahl2 + zErgebnis; zErgebnis = 0; lab_Ergebnis.Text = Convert.ToString(Zahl2);
Operator = 3; lab_zErgebnis.Text = "0"; Komma = 0; } public void div() { lab_Operant.Text = "/"; Zahl2 = Zahl2 + zErgebnis; zErgebnis = 0; lab_Ergebnis.Text = Convert.ToString(Zahl2);
Operator = 4; Komma = 0; } public void mal() { lab_Operant.Text = "x"; Zahl2 = Zahl2 + zErgebnis; zErgebnis = 0; lab_Ergebnis.Text = Convert.ToString(Zahl2);
Operator = 2; Komma = 0; } public void gleich() { if (lab_Ergebnis.Text == "0") { lab_Ergebnis.Text = Convert.ToString(zErgebnis); lab_zErgebnis.Text = "0"; } else { lab_Operant.Text = ""; lab_zErgebnis.Text = "0"; if (Operator == 1) { Ergebnis = zErgebnis + Zahl2; }
if (Operator == 15) { MessageBox.Show("Bitte zuerst die Klammer schließen!", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Information); lab_Operant.Text = ""; lab_Ergebnis.Text = "0"; lab_zErgebnis.Text = "0"; Ergebnis = 0; zErgebnis = 0; Zahl2 = 0; y = 0; Komma = 0; }
if (Operator == 2) { Ergebnis = zErgebnis * Zahl2; }
if (Operator == 3) { Ergebnis = Zahl2 - zErgebnis; }
if (Operator == 4) { Ergebnis = Zahl2 / zErgebnis; }
if (Operator == 5) { if (Ergebnis == 0) { Ergebnis = Convert.ToDecimal(Math.Pow(Convert.ToDouble(y), Convert.ToDouble(zErgebnis))); }
if (zErgebnis == 0) { Ergebnis = Convert.ToDecimal(Math.Pow(Convert.ToDouble(y), Convert.ToDouble(Ergebnis))); }
}
if (Operator == 6) { if (Ergebnis == 0) { Ergebnis = Convert.ToDecimal(Math.Pow(Convert.ToDouble(y), 1.0 / Convert.ToDouble(zErgebnis))); } if (zErgebnis == 0) { Ergebnis = Convert.ToDecimal(Math.Pow(Convert.ToDouble(y), 1.0 / Convert.ToDouble(Ergebnis))); }
}
Istgleich(); Komma = 0; } } public void Istgleich() { Zahl2 = Ergebnis;
lab_Ergebnis.Text = Convert.ToString(Ergebnis);
zErgebnis = 0; } public void zEinschreiben() { lab_zErgebnis.Text = Convert.ToString(zErgebnis);
} private void btn_Ziffer1_Click(object sender, EventArgs e) { Nummer1(); } private void btn_Ziffer2_Click(object sender, EventArgs e) { Nummer2(); } private void btn_Ziffer3_Click(object sender, EventArgs e) { Nummer3(); } private void btn_Ziffer4_Click(object sender, EventArgs e) { Nummer4(); } private void btn_Ziffer5_Click(object sender, EventArgs e) { Nummer5(); } private void btn_Ziffer6_Click(object sender, EventArgs e) { Nummer6(); } private void btn_Ziffer7_Click(object sender, EventArgs e) { Nummer7(); } private void btn_Ziffer8_Click(object sender, EventArgs e) { Nummer8(); } private void btn_Ziffer9_Click(object sender, EventArgs e) { Nummer9(); } private void btn_Ziffer0_Click(object sender, EventArgs e) { Nummer0(); } private void btn_Plus_Click(object sender, EventArgs e) { Plus(); } private void btn_ergebnis_Click(object sender, EventArgs e) { gleich(); } private void btn_AC_Click(object sender, EventArgs e) { lab_Operant.Text = ""; lab_Ergebnis.Text = "0"; lab_zErgebnis.Text = "0"; Ergebnis = 0; zErgebnis = 0; Zahl2 = 0; y = 0; Komma = 0; } private void btn_C_Click(object sender, EventArgs e) {
lab_zErgebnis.Text = "0"; zErgebnis = 0; Komma = 0; } private void btn_Mal_Click(object sender, EventArgs e) { mal();
} private void btn_div_Click(object sender, EventArgs e) { div(); } private void btn_Minus_Click(object sender, EventArgs e) { Minus(); } private void btn_VZ_Click(object sender, EventArgs e) { Ergebnis = Ergebnis * (-1); lab_Ergebnis.Text = Convert.ToString(Ergebnis); } private void btn_Komma_Click(object sender, EventArgs e) { Komma = 0.1;
} private void btn_hochzwei_Click(object sender, EventArgs e) { if (Ergebnis == 0) { Ergebnis = zErgebnis * zErgebnis; } if (zErgebnis == 0) { Ergebnis = Ergebnis * Ergebnis; }
if (lab_zErgebnis.Text != "0" & lab_Ergebnis.Text != "0") { Ergebnis = Ergebnis + (zErgebnis * zErgebnis); }
Istgleich(); lab_zErgebnis.Text = "0"; Komma = 0; } private void btn_hochy_Click(object sender, EventArgs e) { if (zErgebnis == 0) { y = Ergebnis; lab_Ergebnis.Text = Convert.ToString(y); Ergebnis = 0; }
else { y = zErgebnis; lab_Ergebnis.Text = Convert.ToString(y); zErgebnis = 0; }
Operator = 5; lab_Operant.Text = "^"; Komma = 0; } private void btn_wurzely_Click(object sender, EventArgs e) { if (zErgebnis == 0) { y = Ergebnis; lab_Ergebnis.Text = Convert.ToString(y); Ergebnis = 0; } else { y = zErgebnis; lab_Ergebnis.Text = Convert.ToString(y); zErgebnis = 0; } Operator = 6; lab_zErgebnis.Text = "0"; lab_Operant.Text = "?"; Komma = 0; } private void btn_wurzel_Click_1(object sender, EventArgs e) { if (zErgebnis == 0) { Ergebnis = Convert.ToDecimal(Math.Pow(Convert.ToDouble(Ergebnis), 1.0 / 2.0)); lab_Ergebnis.Text = Convert.ToString(Ergebnis); }
if (Ergebnis == 0) { Ergebnis = Convert.ToDecimal(Math.Pow(Convert.ToDouble(zErgebnis), 1.0 / 2.0)); lab_Ergebnis.Text = Convert.ToString(Ergebnis); lab_zErgebnis.Text = "0"; zErgebnis = 0;
} Komma = 0; } private void btn_Tastatur_Click(object sender, EventArgs e) { btn_AC.Enabled = false; btn_C.Enabled = false; btn_div.Enabled = false; btn_ergebnis.Enabled = false;
btn_hochy.Enabled = false; btn_hochzwei.Enabled = false; btn_Komma.Enabled = false; btn_Mal.Enabled = false; btn_Minus.Enabled = false; btn_Plus.Enabled = false; btn_VZ.Enabled = false; btn_wurzel.Enabled = false; btn_wurzely.Enabled = false; btn_Ziffer0.Enabled = false; btn_Ziffer1.Enabled = false; btn_Ziffer2.Enabled = false; btn_Ziffer3.Enabled = false; btn_Ziffer4.Enabled = false; btn_Ziffer5.Enabled = false; btn_Ziffer6.Enabled = false; btn_Ziffer7.Enabled = false; btn_Ziffer8.Enabled = false; btn_Ziffer9.Enabled = false;
btn_Tastatur.Enabled = false; btn_Tastatur.Visible = false; btn_Maus.Enabled = true; btn_Maus.Visible = true; } private void btn_Maus_Click(object sender, EventArgs e) { btn_AC.Enabled = true; btn_C.Enabled = true; btn_div.Enabled = true; btn_ergebnis.Enabled = true; btn_hochy.Enabled = true; btn_hochzwei.Enabled = true; btn_Komma.Enabled = true; btn_Mal.Enabled = true; btn_Minus.Enabled = true; btn_Plus.Enabled = true; btn_VZ.Enabled = true; btn_wurzel.Enabled = true; btn_wurzely.Enabled = true; btn_Ziffer0.Enabled = true; btn_Ziffer1.Enabled = true; btn_Ziffer2.Enabled = true; btn_Ziffer3.Enabled = true; btn_Ziffer4.Enabled = true; btn_Ziffer5.Enabled = true; btn_Ziffer6.Enabled = true; btn_Ziffer7.Enabled = true; btn_Ziffer8.Enabled = true; btn_Ziffer9.Enabled = true;
btn_Tastatur.Enabled = true; btn_Tastatur.Visible = true; btn_Maus.Enabled = false; btn_Maus.Visible = false; } private void Form1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.D1) { Nummer1(); } if (e.KeyCode == Keys.D2) { Nummer2(); } if (e.KeyCode == Keys.D3) { Nummer3(); } if (e.KeyCode == Keys.D4) { Nummer4(); } if (e.KeyCode == Keys.D5) { Nummer5(); } if (e.KeyCode == Keys.D6) { Nummer6(); } if (e.KeyCode == Keys.D7) { Nummer7(); } if (e.KeyCode == Keys.D8) { Nummer8(); } if (e.KeyCode == Keys.D9) { Nummer9(); } if (e.KeyCode == Keys.D0) { Nummer0(); }
if (e.KeyCode == Keys.Oemplus) { Plus(); }
if (e.KeyCode == Keys.OemMinus) { Minus(); }
if (e.KeyCode == Keys.OemPeriod) { Komma = 1; lab_Operant.Text = ","; }
if (e.KeyCode == Keys.Oemcomma) { Komma = 1; lab_Operant.Text = ","; }
if (e.KeyCode == Keys.Multiply) { mal(); }
if (e.KeyCode == Keys.Divide) { div(); }
if (e.KeyCode == Keys.Enter) { gleich(); } }
} } |
PS: Bei der Form wird auch der Name nicht angezeigt, ich habe auch eingestellt dass es ohne Icon angezeigt wird, aber beim Debug kommt eins....
Moderiert von Christian S.: Quote- durch C#-Tags ersetzt
|
|
ujr
      
Beiträge: 102
Erhaltene Danke: 12
|
Verfasst: Di 24.05.11 10:42
Hallo,
hast Du die .Designer-Datei editiert? Vielleicht InitializeComponents() aus dem Konstruktor entfernt?
|
|
Kracker 
      
Beiträge: 19
|
Verfasst: Di 24.05.11 11:00
Nein, ist vorhanden...
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: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390:
| namespace Calculator { partial class Form1 { private System.ComponentModel.IContainer components = null;
protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); }
#region Vom Windows Form-Designer generierter Code
private void InitializeComponent() { this.btn_Maus = new System.Windows.Forms.Button(); this.btn_Tastatur = new System.Windows.Forms.Button(); this.lab_Operant = new System.Windows.Forms.Label(); this.btn_hochy = new System.Windows.Forms.Button(); this.btn_wurzely = new System.Windows.Forms.Button(); this.btn_wurzel = new System.Windows.Forms.Button(); this.btn_hochzwei = new System.Windows.Forms.Button(); this.btn_ergebnis = new System.Windows.Forms.Button(); this.btn_VZ = new System.Windows.Forms.Button(); this.btn_C = new System.Windows.Forms.Button(); this.btn_AC = new System.Windows.Forms.Button(); this.btn_div = new System.Windows.Forms.Button(); this.btn_Mal = new System.Windows.Forms.Button(); this.btn_Minus = new System.Windows.Forms.Button(); this.btn_Plus = new System.Windows.Forms.Button(); this.btn_Komma = new System.Windows.Forms.Button(); this.btn_Ziffer0 = new System.Windows.Forms.Button(); this.lab_zErgebnis = new System.Windows.Forms.Label(); this.lab_Ergebnis = new System.Windows.Forms.Label(); this.btn_Ziffer7 = new System.Windows.Forms.Button(); this.btn_Ziffer8 = new System.Windows.Forms.Button(); this.btn_Ziffer9 = new System.Windows.Forms.Button(); this.btn_Ziffer6 = new System.Windows.Forms.Button(); this.btn_Ziffer5 = new System.Windows.Forms.Button(); this.btn_Ziffer4 = new System.Windows.Forms.Button(); this.btn_Ziffer3 = new System.Windows.Forms.Button(); this.btn_Ziffer2 = new System.Windows.Forms.Button(); this.btn_Ziffer1 = new System.Windows.Forms.Button(); this.SuspendLayout(); this.btn_Maus.Enabled = false; this.btn_Maus.Location = new System.Drawing.Point(204, 255); this.btn_Maus.Name = "btn_Maus"; this.btn_Maus.Size = new System.Drawing.Size(40, 42); this.btn_Maus.TabIndex = 57; this.btn_Maus.Text = "Maus"; this.btn_Maus.UseVisualStyleBackColor = true; this.btn_Maus.Visible = false; this.btn_Tastatur.Location = new System.Drawing.Point(204, 257); this.btn_Tastatur.Name = "btn_Tastatur"; this.btn_Tastatur.Size = new System.Drawing.Size(40, 42); this.btn_Tastatur.TabIndex = 56; this.btn_Tastatur.Text = "Tastatur"; this.btn_Tastatur.UseVisualStyleBackColor = true; this.lab_Operant.AutoSize = true; this.lab_Operant.Location = new System.Drawing.Point(22, 51); this.lab_Operant.Name = "lab_Operant"; this.lab_Operant.Size = new System.Drawing.Size(0, 13); this.lab_Operant.TabIndex = 55; this.btn_hochy.Location = new System.Drawing.Point(204, 121); this.btn_hochy.Name = "btn_hochy"; this.btn_hochy.Size = new System.Drawing.Size(40, 40); this.btn_hochy.TabIndex = 54; this.btn_hochy.Text = "x^y"; this.btn_hochy.UseVisualStyleBackColor = true; this.btn_wurzely.Location = new System.Drawing.Point(204, 213); this.btn_wurzely.Name = "btn_wurzely"; this.btn_wurzely.Size = new System.Drawing.Size(40, 40); this.btn_wurzely.TabIndex = 53; this.btn_wurzely.Text = "y?"; this.btn_wurzely.UseVisualStyleBackColor = true; this.btn_wurzel.Location = new System.Drawing.Point(204, 167); this.btn_wurzel.Name = "btn_wurzel"; this.btn_wurzel.Size = new System.Drawing.Size(40, 40); this.btn_wurzel.TabIndex = 52; this.btn_wurzel.Text = "?"; this.btn_wurzel.UseVisualStyleBackColor = true; this.btn_hochzwei.Location = new System.Drawing.Point(204, 75); this.btn_hochzwei.Name = "btn_hochzwei"; this.btn_hochzwei.Size = new System.Drawing.Size(40, 40); this.btn_hochzwei.TabIndex = 51; this.btn_hochzwei.Text = "x²"; this.btn_hochzwei.UseVisualStyleBackColor = true; this.btn_ergebnis.Location = new System.Drawing.Point(158, 75); this.btn_ergebnis.Name = "btn_ergebnis"; this.btn_ergebnis.Size = new System.Drawing.Size(40, 40); this.btn_ergebnis.TabIndex = 50; this.btn_ergebnis.Text = "="; this.btn_ergebnis.UseVisualStyleBackColor = true; this.btn_VZ.Location = new System.Drawing.Point(112, 75); this.btn_VZ.Name = "btn_VZ"; this.btn_VZ.Size = new System.Drawing.Size(40, 40); this.btn_VZ.TabIndex = 49; this.btn_VZ.Text = "+/-"; this.btn_VZ.UseVisualStyleBackColor = true; this.btn_C.Location = new System.Drawing.Point(66, 75); this.btn_C.Name = "btn_C"; this.btn_C.Size = new System.Drawing.Size(40, 40); this.btn_C.TabIndex = 48; this.btn_C.Text = "C"; this.btn_C.UseVisualStyleBackColor = true; this.btn_AC.Location = new System.Drawing.Point(20, 75); this.btn_AC.Name = "btn_AC"; this.btn_AC.Size = new System.Drawing.Size(40, 40); this.btn_AC.TabIndex = 47; this.btn_AC.Text = "AC"; this.btn_AC.UseVisualStyleBackColor = true; this.btn_div.Location = new System.Drawing.Point(158, 259); this.btn_div.Name = "btn_div"; this.btn_div.Size = new System.Drawing.Size(40, 40); this.btn_div.TabIndex = 46; this.btn_div.Text = "/"; this.btn_div.UseVisualStyleBackColor = true; this.btn_Mal.Location = new System.Drawing.Point(158, 213); this.btn_Mal.Name = "btn_Mal"; this.btn_Mal.Size = new System.Drawing.Size(40, 40); this.btn_Mal.TabIndex = 45; this.btn_Mal.Text = "x"; this.btn_Mal.UseVisualStyleBackColor = true; this.btn_Minus.Location = new System.Drawing.Point(158, 167); this.btn_Minus.Name = "btn_Minus"; this.btn_Minus.Size = new System.Drawing.Size(40, 40); this.btn_Minus.TabIndex = 44; this.btn_Minus.Text = "-"; this.btn_Minus.UseVisualStyleBackColor = true; this.btn_Plus.Location = new System.Drawing.Point(158, 121); this.btn_Plus.Name = "btn_Plus"; this.btn_Plus.Size = new System.Drawing.Size(40, 40); this.btn_Plus.TabIndex = 43; this.btn_Plus.Text = "+"; this.btn_Plus.UseVisualStyleBackColor = true; this.btn_Komma.Location = new System.Drawing.Point(20, 257); this.btn_Komma.Name = "btn_Komma"; this.btn_Komma.Size = new System.Drawing.Size(40, 40); this.btn_Komma.TabIndex = 42; this.btn_Komma.Text = ","; this.btn_Komma.UseVisualStyleBackColor = true; this.btn_Ziffer0.Location = new System.Drawing.Point(65, 259); this.btn_Ziffer0.Name = "btn_Ziffer0"; this.btn_Ziffer0.Size = new System.Drawing.Size(87, 40); this.btn_Ziffer0.TabIndex = 41; this.btn_Ziffer0.Text = "0"; this.btn_Ziffer0.UseVisualStyleBackColor = true; this.lab_zErgebnis.AutoSize = true; this.lab_zErgebnis.Location = new System.Drawing.Point(34, 51); this.lab_zErgebnis.Name = "lab_zErgebnis"; this.lab_zErgebnis.Size = new System.Drawing.Size(13, 13); this.lab_zErgebnis.TabIndex = 40; this.lab_zErgebnis.Text = "0"; this.lab_Ergebnis.AutoSize = true; this.lab_Ergebnis.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.lab_Ergebnis.Location = new System.Drawing.Point(20, 10); this.lab_Ergebnis.Name = "lab_Ergebnis"; this.lab_Ergebnis.Size = new System.Drawing.Size(27, 29); this.lab_Ergebnis.TabIndex = 39; this.lab_Ergebnis.Text = "0"; this.btn_Ziffer7.Location = new System.Drawing.Point(19, 213); this.btn_Ziffer7.Name = "btn_Ziffer7"; this.btn_Ziffer7.Size = new System.Drawing.Size(41, 40); this.btn_Ziffer7.TabIndex = 38; this.btn_Ziffer7.Text = "7"; this.btn_Ziffer7.UseVisualStyleBackColor = true; this.btn_Ziffer8.Location = new System.Drawing.Point(66, 213); this.btn_Ziffer8.Name = "btn_Ziffer8"; this.btn_Ziffer8.Size = new System.Drawing.Size(40, 40); this.btn_Ziffer8.TabIndex = 37; this.btn_Ziffer8.Text = "8"; this.btn_Ziffer8.UseVisualStyleBackColor = true; this.btn_Ziffer9.Location = new System.Drawing.Point(112, 213); this.btn_Ziffer9.Name = "btn_Ziffer9"; this.btn_Ziffer9.Size = new System.Drawing.Size(40, 40); this.btn_Ziffer9.TabIndex = 36; this.btn_Ziffer9.Text = "9"; this.btn_Ziffer9.UseVisualStyleBackColor = true; this.btn_Ziffer6.Location = new System.Drawing.Point(112, 167); this.btn_Ziffer6.Name = "btn_Ziffer6"; this.btn_Ziffer6.Size = new System.Drawing.Size(40, 40); this.btn_Ziffer6.TabIndex = 35; this.btn_Ziffer6.Text = "6"; this.btn_Ziffer6.UseVisualStyleBackColor = true; this.btn_Ziffer5.Location = new System.Drawing.Point(66, 167); this.btn_Ziffer5.Name = "btn_Ziffer5"; this.btn_Ziffer5.Size = new System.Drawing.Size(40, 40); this.btn_Ziffer5.TabIndex = 34; this.btn_Ziffer5.Text = "5"; this.btn_Ziffer5.UseVisualStyleBackColor = true; this.btn_Ziffer4.Location = new System.Drawing.Point(20, 167); this.btn_Ziffer4.Name = "btn_Ziffer4"; this.btn_Ziffer4.Size = new System.Drawing.Size(40, 40); this.btn_Ziffer4.TabIndex = 33; this.btn_Ziffer4.Text = "4"; this.btn_Ziffer4.UseVisualStyleBackColor = true; this.btn_Ziffer3.Location = new System.Drawing.Point(112, 121); this.btn_Ziffer3.Name = "btn_Ziffer3"; this.btn_Ziffer3.Size = new System.Drawing.Size(40, 40); this.btn_Ziffer3.TabIndex = 32; this.btn_Ziffer3.Text = "3"; this.btn_Ziffer3.UseVisualStyleBackColor = true; this.btn_Ziffer2.Location = new System.Drawing.Point(66, 121); this.btn_Ziffer2.Name = "btn_Ziffer2"; this.btn_Ziffer2.Size = new System.Drawing.Size(40, 40); this.btn_Ziffer2.TabIndex = 31; this.btn_Ziffer2.Text = "2"; this.btn_Ziffer2.UseVisualStyleBackColor = true; this.btn_Ziffer1.Location = new System.Drawing.Point(20, 121); this.btn_Ziffer1.Name = "btn_Ziffer1"; this.btn_Ziffer1.Size = new System.Drawing.Size(40, 40); this.btn_Ziffer1.TabIndex = 30; this.btn_Ziffer1.Text = "1"; this.btn_Ziffer1.UseVisualStyleBackColor = true; this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(263, 308); this.Controls.Add(this.btn_Maus); this.Controls.Add(this.btn_Tastatur); this.Controls.Add(this.lab_Operant); this.Controls.Add(this.btn_hochy); this.Controls.Add(this.btn_wurzely); this.Controls.Add(this.btn_wurzel); this.Controls.Add(this.btn_hochzwei); this.Controls.Add(this.btn_ergebnis); this.Controls.Add(this.btn_VZ); this.Controls.Add(this.btn_C); this.Controls.Add(this.btn_AC); this.Controls.Add(this.btn_div); this.Controls.Add(this.btn_Mal); this.Controls.Add(this.btn_Minus); this.Controls.Add(this.btn_Plus); this.Controls.Add(this.btn_Komma); this.Controls.Add(this.btn_Ziffer0); this.Controls.Add(this.lab_zErgebnis); this.Controls.Add(this.lab_Ergebnis); this.Controls.Add(this.btn_Ziffer7); this.Controls.Add(this.btn_Ziffer8); this.Controls.Add(this.btn_Ziffer9); this.Controls.Add(this.btn_Ziffer6); this.Controls.Add(this.btn_Ziffer5); this.Controls.Add(this.btn_Ziffer4); this.Controls.Add(this.btn_Ziffer3); this.Controls.Add(this.btn_Ziffer2); this.Controls.Add(this.btn_Ziffer1); this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.Name = "Form1"; this.ShowIcon = false; this.Text = "Calculator"; this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown); this.ResumeLayout(false); this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button btn_Maus; private System.Windows.Forms.Button btn_Tastatur; private System.Windows.Forms.Label lab_Operant; private System.Windows.Forms.Button btn_hochy; private System.Windows.Forms.Button btn_wurzely; private System.Windows.Forms.Button btn_wurzel; private System.Windows.Forms.Button btn_hochzwei; private System.Windows.Forms.Button btn_ergebnis; private System.Windows.Forms.Button btn_VZ; private System.Windows.Forms.Button btn_C; private System.Windows.Forms.Button btn_AC; private System.Windows.Forms.Button btn_div; private System.Windows.Forms.Button btn_Mal; private System.Windows.Forms.Button btn_Minus; private System.Windows.Forms.Button btn_Plus; private System.Windows.Forms.Button btn_Komma; private System.Windows.Forms.Button btn_Ziffer0; private System.Windows.Forms.Label lab_zErgebnis; private System.Windows.Forms.Label lab_Ergebnis; private System.Windows.Forms.Button btn_Ziffer7; private System.Windows.Forms.Button btn_Ziffer8; private System.Windows.Forms.Button btn_Ziffer9; private System.Windows.Forms.Button btn_Ziffer6; private System.Windows.Forms.Button btn_Ziffer5; private System.Windows.Forms.Button btn_Ziffer4; private System.Windows.Forms.Button btn_Ziffer3; private System.Windows.Forms.Button btn_Ziffer2; private System.Windows.Forms.Button btn_Ziffer1;
} } |
Moderiert von Christian S.: Quote- durch C#-Tags ersetzt
|
|
Th69
      

Beiträge: 4807
Erhaltene Danke: 1061
Win10
C#, C++ (VS 2017/19/22)
|
Verfasst: Di 24.05.11 11:43
Hallo Kracker,
so wie 'ujr' schon angemerkt hat, hast du bei dir den Konstruktor für Form1 gelöscht:
C#-Quelltext 1: 2: 3: 4:
| Form1() { InitializeComponents(); } |
P.S: Quelltexte solltest du als [ cs ] ... [ /cs ] (ohne die Leerzeichen) posten, nicht als Zitat (Quote)...
|
|
Kracker 
      
Beiträge: 19
|
Verfasst: Mi 25.05.11 09:05
achso, ok, aber wo genau tu ich die jetzt rein?
|
|
bakachan
      
Beiträge: 503
Erhaltene Danke: 34
W7 (x64) Ultimate
C# / VB.NET (VS2010 Ultimate)
|
Verfasst: Mi 25.05.11 09:53
Es ist ein Konstruktor für Form1 also in deiner Form1-Klasse natürlich.
|
|
Kracker 
      
Beiträge: 19
|
Verfasst: Mi 25.05.11 09:58
In Form1.cs?
C#-Quelltext 1: 2: 3: 4:
| private void Form1_Load(object sender, EventArgs e) { InitializeComponent(); } |
|
|
bakachan
      
Beiträge: 503
Erhaltene Danke: 34
W7 (x64) Ultimate
C# / VB.NET (VS2010 Ultimate)
|
Verfasst: Mi 25.05.11 10:38
Nicht als Load_EventHandler sondern als Konstruktor...
|
|
jaenicke
      
Beiträge: 19341
Erhaltene Danke: 1752
W11 x64 (Chrome, Edge)
Delphi 12 Pro, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
|
Verfasst: Mi 25.05.11 10:51
|
|
Kracker 
      
Beiträge: 19
|
Verfasst: Mi 25.05.11 10:57
ja ok, jetzt habe ich
C#-Quelltext 1: 2: 3: 4:
| public Form1() { InitializeComponent(); } |
eingefügt, und es sind wieder alle Sachen da, nur iwie wenn ich iwas drücke rechnet er nix, verher hats aber noch funktioniert....
|
|
bakachan
      
Beiträge: 503
Erhaltene Danke: 34
W7 (x64) Ultimate
C# / VB.NET (VS2010 Ultimate)
|
Verfasst: Mi 25.05.11 11:01
Kontrolliere ob die EventHandler zugewiesen sind.
Wenn ja: setz Breakpoints und schau dir an was er wo macht.
|
|
Kracker 
      
Beiträge: 19
|
Verfasst: Mi 25.05.11 11:14
Wie ob die Eventhanbdler zugewiesen sind? Wo schau ich das nach?
Wenn ich Einzelschritt Debuge, dann geht er zwar die Variablen durch, aber die die voids nicht..
|
|
bakachan
      
Beiträge: 503
Erhaltene Danke: 34
W7 (x64) Ultimate
C# / VB.NET (VS2010 Ultimate)
|
Verfasst: Mi 25.05.11 11:22
Dann solltest du vielleicht erstmal ein Buch, über Programmierung oder C#, lesen um Grundlagen wie Funktionen und Events zu lernen.
|
|
Kracker 
      
Beiträge: 19
|
Verfasst: Mi 25.05.11 11:30
habs schon...
du hast recht ja, es liegt am Eventhandler, muss ich die jetzt bei jedem einzeln hin zufügen?
|
|
|