Dudas y recursos para programas que no están en ninguno otro de los foros.
Avatar de Usuario
por Mgomezv
#4418 Buenas tardes

tengo un problema me sale esta pantallan y no puedo volver al formato de la supercalculadora
intento continuar con el primer video del tutorial pero no puedo continuar como vuelvo atras
te adjunto la pantalla emergente
saludos espero tus comentarios
Adjuntos
programar supercalculadora.png
Avatar de Usuario
por Ludwig Suarez
#4419 Hola Sr. Mgomezv

Bienvenido al Foro, gracias por preguntar, Para poder ayudarle mejor necesita revisar la línea 48 del código. Verifique bien todas las líneas de códigos, en programación es muy importante todo la sintaxis, absolutamente todas las llaves, comillas, punto y comas, paréntesis, corchetes, todo es muy importante para poder correr cualquier programa,
Avatar de Usuario
por Mgomezv
#4422 Buenos días
y gracias por su pronta respuesta
les adjunto el error en el codigo, por mas que modifique el mismo no se el codigo correcto a introducir
los otros errores , fueron solucionados pero el de la linea 48 no he podido

this.btnadd.Click += new System.EventHandler(this.btnadd_Click);


saludos y espero sus comentarios
Adjuntos
programar supercalculadora.png
Avatar de Usuario
por Ludwig Suarez
#4424 Hola Sr. Mgomezv;

Viendo el código y leyendo el mensaje de error el problema tiene que ver un poco con la versión. La definicion del Error es;

El diseñador no puede procesar el nombre desconocido 'SuspendLayout' en la línea 48. El código dentro del método 'InitializeComponent' es generado por el diseñador y no debe modificarse manualmente. Por favor, elimine cualquier cambio e intente abrir el diseñador de nuevo.

Aún cuando no lo hayas modificado algunas versiones pueden dar este error, viendo el código pareciera estar bien, aquí la recomendación es cambiar el Marco de destino, esto elimina este problema, no es la versión del marco lo que importa, simplemente cambiarlo a cualquier cosa y nuevamente leerá código sin el error.

Le voy a dejar una imagen de ejemplo:

https://ibb.co/NsChT79

Finalice y luego elimine el evento de error. Se solucionará ese problema.

https://ibb.co/HC9cfPP
Avatar de Usuario
por Mgomezv
#4426 Buenas tardes
Ahora intento introducir el codigo de abajo y no encuentro las barras rectas del ejemplo
private void SetOperandTxt(string value)
{
if (value == "9") ││ (value == "8")(value == "7");
_OperandTxt = _OperandTxt + value;
txtResult.Text = _OperandTxt;

No se seran las mismas utilizado el codigo asc nro 179 │ │ pero me dan error
Avatar de Usuario
por Mgomezv
#4427 Buenas noches
Ya he solventado la duda la barra es un codigo logico significa Or en ingles y se acciona con el codigo asc 124
Gracias por vuestro interes
Saludos
Avatar de Usuario
por Mgomezv
#4429 Buenas tardes la palabra decimal me da error siguiente:
Error 1 A namespace cannot directly contain members such as fields or methods 45 8 Calculadora
y el codigo private void .- me da este error : Error 2 Expected class, delegate, enum, interface, or struct 72 17 Calculadora
estos son los dos unicos errores que me aparecen y no se continuar

saludos y espero sus comentarios

decimal result = 0);

if(_Operator == "+")
{
result = _Operand + decimal.Parse(_OperandTxt);

else if(_Operator == "-")
{
result = _Operand - decimal.Parse(_OperandTxt);

}
else if(_Operator == "*")
{
result = _Operand * decimal.Parse(_OperandTxt);

}
else if(_Operator == "/")
{
result = _Operand / decimal.Parse(_OperandTxt);

}

txtResult.Text = result.ToString();

}


private void fMain_Load(object sender, EventArgs e)

{

}

private void btnumber9_Click(object sender, EventArgs e)
{
SetOperandTxt("9");

}

private void btnumber8_Click(object sender, EventArgs e)
{
SetOperandTxt("8");

}

private void btnumber7_Click(object sender, EventArgs e)
{
SetOperandTxt("7");
}

private void btnumber4_Click(object sender, EventArgs e)
{
SetOperandTxt("4");
}

private void btnumber5_Click(object sender, EventArgs e)
{
SetOperandTxt("5");
}

private void btnumber6_Click(object sender, EventArgs e)
{
SetOperandTxt("6");
}

private void btnumber1_Click(object sender, EventArgs e)
{
SetOperandTxt("1");
}

private void btnumber2_Click(object sender, EventArgs e)
{
SetOperandTxt("2");
}

private void btnumber3_Click(object sender, EventArgs e)
{
SetOperandTxt("3");
}

private void btnumber0_Click(object sender, EventArgs e)
{
SetOperandTxt("0");
}

private void btnEqual_Click(object sender, EventArgs e)
{

}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}

private void btnAdd_Click(object sender, EventArgs e)
{

}

private void fMain_KeyPress(object sender, KeyPressEventArgs e)
{
SetOperandTxt(e.KeyChar.ToString());
Avatar de Usuario
por Mgomezv
#4430 Buenas tardes
Intentando solucionar el problema anterior me sale de nuevo esta pantalla

y el error al que hace mención no 60 es

btnumber7_Click

y no puedo iniciar el form con la calculadora

namespace Calculadora
{
partial class fMain
{
/// <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()
{
this.btnumber7 = new System.Windows.Forms.Button();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.archivoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.salirToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.btnumber9 = new System.Windows.Forms.Button();
this.btnumber8 = new System.Windows.Forms.Button();
this.btnumber6 = new System.Windows.Forms.Button();
this.btnumber5 = new System.Windows.Forms.Button();
this.btnumber4 = new System.Windows.Forms.Button();
this.btnumber3 = new System.Windows.Forms.Button();
this.btnumber2 = new System.Windows.Forms.Button();
this.btnumber1 = new System.Windows.Forms.Button();
this.btnumber0 = new System.Windows.Forms.Button();
this.btnEqual = new System.Windows.Forms.Button();
this.txtResult = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.btnAdd = new System.Windows.Forms.Button();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// btnumber7
//
this.btnumber7.Location = new System.Drawing.Point(16, 184);
this.btnumber7.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.btnumber7.Name = "btnumber7";
this.btnumber7.Size = new System.Drawing.Size(56, 50);
this.btnumber7.TabIndex = 0;
this.btnumber7.Text = "7";
this.btnumber7.UseVisualStyleBackColor = true;
this.btnumber7.Click += new System.EventHandler(this.btnumber7_Click);
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.archivoToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Padding = new System.Windows.Forms.Padding(8, 3, 0, 3);
this.menuStrip1.Size = new System.Drawing.Size(421, 25);
this.menuStrip1.TabIndex = 1;
this.menuStrip1.Text = "menuStrip1";
//
// archivoToolStripMenuItem
//
this.archivoToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.salirToolStripMenuItem});
this.archivoToolStripMenuItem.Name = "archivoToolStripMenuItem";
this.archivoToolStripMenuItem.Size = new System.Drawing.Size(60, 19);
this.archivoToolStripMenuItem.Text = "Archivo";
//
// salirToolStripMenuItem
//
this.salirToolStripMenuItem.Name = "salirToolStripMenuItem";
this.salirToolStripMenuItem.Size = new System.Drawing.Size(152, 22);
this.salirToolStripMenuItem.Text = "Salir";
//
// btnumber9
//
this.btnumber9.Location = new System.Drawing.Point(144, 184);
this.btnumber9.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.btnumber9.Name = "btnumber9";
this.btnumber9.Size = new System.Drawing.Size(56, 50);
this.btnumber9.TabIndex = 2;
this.btnumber9.Text = "9";
this.btnumber9.UseVisualStyleBackColor = true;
this.btnumber9.Click += new System.EventHandler(this.btnumber9_Click);
//
// btnumber8
//
this.btnumber8.Location = new System.Drawing.Point(80, 184);
this.btnumber8.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.btnumber8.Name = "btnumber8";
this.btnumber8.Size = new System.Drawing.Size(56, 50);
this.btnumber8.TabIndex = 3;
this.btnumber8.Text = "8";
this.btnumber8.UseVisualStyleBackColor = true;
this.btnumber8.Click += new System.EventHandler(this.btnumber8_Click);
//
// btnumber6
//
this.btnumber6.Location = new System.Drawing.Point(144, 260);
this.btnumber6.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.btnumber6.Name = "btnumber6";
this.btnumber6.Size = new System.Drawing.Size(56, 50);
this.btnumber6.TabIndex = 4;
this.btnumber6.Text = "6";
this.btnumber6.UseVisualStyleBackColor = true;
this.btnumber6.Click += new System.EventHandler(this.btnumber6_Click);
//
// btnumber5
//
this.btnumber5.Location = new System.Drawing.Point(80, 260);
this.btnumber5.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.btnumber5.Name = "btnumber5";
this.btnumber5.Size = new System.Drawing.Size(56, 50);
this.btnumber5.TabIndex = 5;
this.btnumber5.Text = "5";
this.btnumber5.UseVisualStyleBackColor = true;
this.btnumber5.Click += new System.EventHandler(this.btnumber5_Click);
//
// btnumber4
//
this.btnumber4.Location = new System.Drawing.Point(16, 260);
this.btnumber4.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.btnumber4.Name = "btnumber4";
this.btnumber4.Size = new System.Drawing.Size(56, 50);
this.btnumber4.TabIndex = 6;
this.btnumber4.Text = "4";
this.btnumber4.UseVisualStyleBackColor = true;
this.btnumber4.Click += new System.EventHandler(this.btnumber4_Click);
//
// btnumber3
//
this.btnumber3.Location = new System.Drawing.Point(144, 335);
this.btnumber3.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.btnumber3.Name = "btnumber3";
this.btnumber3.Size = new System.Drawing.Size(56, 50);
this.btnumber3.TabIndex = 7;
this.btnumber3.Text = "3";
this.btnumber3.UseVisualStyleBackColor = true;
this.btnumber3.Click += new System.EventHandler(this.btnumber3_Click);
//
// btnumber2
//
this.btnumber2.Location = new System.Drawing.Point(80, 335);
this.btnumber2.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.btnumber2.Name = "btnumber2";
this.btnumber2.Size = new System.Drawing.Size(56, 50);
this.btnumber2.TabIndex = 8;
this.btnumber2.Text = "2";
this.btnumber2.UseVisualStyleBackColor = true;
this.btnumber2.Click += new System.EventHandler(this.btnumber2_Click);
//
// btnumber1
//
this.btnumber1.Location = new System.Drawing.Point(16, 335);
this.btnumber1.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.btnumber1.Name = "btnumber1";
this.btnumber1.Size = new System.Drawing.Size(56, 50);
this.btnumber1.TabIndex = 9;
this.btnumber1.Text = "1";
this.btnumber1.UseVisualStyleBackColor = true;
this.btnumber1.Click += new System.EventHandler(this.btnumber1_Click);
//
// btnumber0
//
this.btnumber0.Location = new System.Drawing.Point(16, 410);
this.btnumber0.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.btnumber0.Name = "btnumber0";
this.btnumber0.Size = new System.Drawing.Size(120, 50);
this.btnumber0.TabIndex = 10;
this.btnumber0.Text = "0";
this.btnumber0.UseVisualStyleBackColor = true;
this.btnumber0.Click += new System.EventHandler(this.btnumber0_Click);
//
// btnEqual
//
this.btnEqual.Location = new System.Drawing.Point(272, 337);
this.btnEqual.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.btnEqual.Name = "btnEqual";
this.btnEqual.Size = new System.Drawing.Size(56, 123);
this.btnEqual.TabIndex = 11;
this.btnEqual.Text = "=";
this.btnEqual.UseVisualStyleBackColor = true;
this.btnEqual.Click += new System.EventHandler(this.btnEqual_Click);
//
// txtResult
//
this.txtResult.BackColor = System.Drawing.Color.White;
this.txtResult.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txtResult.Location = new System.Drawing.Point(24, 131);
this.txtResult.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.txtResult.Name = "txtResult";
this.txtResult.ReadOnly = true;
this.txtResult.Size = new System.Drawing.Size(346, 29);
this.txtResult.TabIndex = 12;
this.txtResult.Text = "0";
this.txtResult.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.txtResult.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// label1
//
this.label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.label1.Dock = System.Windows.Forms.DockStyle.Top;
this.label1.Image = global::Calculadora.Properties.Resources.BMW_svg;
this.label1.Location = new System.Drawing.Point(0, 25);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(421, 100);
this.label1.TabIndex = 13;
//
// btnAdd
//
this.btnAdd.Location = new System.Drawing.Point(208, 337);
this.btnAdd.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(56, 123);
this.btnAdd.TabIndex = 14;
this.btnAdd.Text = "+";
this.btnAdd.UseVisualStyleBackColor = true;
this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
//
// fMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 22F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.White;
this.ClientSize = new System.Drawing.Size(421, 707);
this.Controls.Add(this.btnAdd);
this.Controls.Add(this.label1);
this.Controls.Add(this.txtResult);
this.Controls.Add(this.btnEqual);
this.Controls.Add(this.btnumber0);
this.Controls.Add(this.btnumber1);
this.Controls.Add(this.btnumber2);
this.Controls.Add(this.btnumber3);
this.Controls.Add(this.btnumber4);
this.Controls.Add(this.btnumber5);
this.Controls.Add(this.btnumber6);
this.Controls.Add(this.btnumber8);
this.Controls.Add(this.btnumber9);
this.Controls.Add(this.btnumber7);
this.Controls.Add(this.menuStrip1);
this.Font = new System.Drawing.Font("Mistral", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.KeyPreview = true;
this.MainMenuStrip = this.menuStrip1;
this.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
this.MaximizeBox = false;
this.Name = "fMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Load += new System.EventHandler(this.fMain_Load);
this.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.fMain_KeyPress);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.Button btnumber7;
private System.Windows.Forms.MenuStrip menuStrip1;
private System.Windows.Forms.ToolStripMenuItem archivoToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem salirToolStripMenuItem;
private System.Windows.Forms.Button btnumber9;
private System.Windows.Forms.Button btnumber8;
private System.Windows.Forms.Button btnumber6;
private System.Windows.Forms.Button btnumber5;
private System.Windows.Forms.Button btnumber4;
private System.Windows.Forms.Button btnumber3;
private System.Windows.Forms.Button btnumber2;
private System.Windows.Forms.Button btnumber1;
private System.Windows.Forms.Button btnumber0;
private System.Windows.Forms.Button btnEqual;
private System.Windows.Forms.TextBox txtResult;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btnAdd;
}
}
Adjuntos
programar supercalculadora.png
Avatar de Usuario
por Ludwig Suarez
#4445 Hola Sr. Mgomezv

lA ASIGANCIÓN CORRECTA ES : decimal result = 0;

decimal result = 0); <------- El error esta en: NO DEBE LLEVAR ESE PARENTESIS )

if(_Operator == "+")
{
result = _Operand + decimal.Parse(_OperandTxt);

else if(_Operator == "-")
{
result = _Operand - decimal.Parse(_OperandTxt);