-1
I have a C# program and it is giving MANY bugs different, I’ll send everyone here, as follows:
Code Error: Description:
So come on.
internal AcessoAdd()
{
InitializeComponent();
}
Error:
System.ComponentModel.Win32Exception:
'Error while creating window identifier.'
Correction: I changed from Ternal to Public
Description: this code was already there, I tried to format the PC as recommended, I tried to tinker with regedit and increase the amount of window identifiers allowed, but nothing helps.
UsuarioForm usuForm = new UsuarioForm();
Error:
System.StackOverflowException
Description: Usuarioform as its name already says, is a form, I create a variable to then open it but this error happens and I’ve tried everything also to make it work.
For now that’s it, you’ll probably have more after you fix this one, but someone knows how to answer me these two?
User Code:
using System;
using System.Collections;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Linq;
using System.Xml.Linq;
using System.Threading.Tasks;
namespace PecsCon
{
public partial class UsuarioForm
{
public UsuarioAdd usuAdd = new UsuarioAdd();
public AcessoAdd acAdd = new AcessoAdd();
internal UsuarioForm()
{
InitializeComponent();
}
public string idgrid;
public string funcidgrid;
public string logingrid;
public string senhagrid;
public int deletadogrid;
public int op;
private void Usuario_Load(object sender, EventArgs e)
{
this.MdiParent = FormPrincipal.DefaultInstance;
this.Dock = DockStyle.None;
//variavel para utilizar a classe
BancoUsuario bncusu = new BancoUsuario();
rbTodos.Checked = true;
//preenche o datagridview
bncusu.PreencheDataGrid(DataGridViewUsu, op);
}
private void ButtonX4_Click(object sender, EventArgs e)
{
acAdd.Show();
if (!string.IsNullOrEmpty(idgrid))
{
acAdd.cboxUsuario.SelectedValue = idgrid;
}
}
private void usuCadastro_Click(object sender, EventArgs e)
{
usuAdd.add_update = 1;
usuAdd.Show();
}
private void TextBox1_TextChanged(object sender, EventArgs e)
{
BancoUsuario bncusu = new BancoUsuario();
bncusu.ProcuraTuplaUsu(ref DataGridViewUsu, procuraUsu, op);
}
private void rbDesativados_CheckedChanged(object sender, EventArgs e)
{
if (rbDesativados.Checked == true)
{
op = 2;
//variavel para utilizar a classe
BancoUsuario bncusu = new BancoUsuario();
//preenche o datagridview
bncusu.PreencheDataGrid(DataGridViewUsu, op);
}
}
private void rbTodos_CheckedChanged(object sender, EventArgs e)
{
if (rbTodos.Checked == true)
{
op = 3;
//variavel para utilizar a classe
BancoUsuario bncusu = new BancoUsuario();
//preenche o datagridview
bncusu.PreencheDataGrid(DataGridViewUsu, op);
}
}
private void rbAtivos_CheckedChanged(object sender, EventArgs e)
{
if (rbAtivos.Checked == true)
{
op = 1;
//variavel para utilizar a classe
BancoUsuario bncusu = new BancoUsuario();
//preenche o datagridview
bncusu.PreencheDataGrid(DataGridViewUsu, op);
}
}
private void usuDeletar_Click(object sender, EventArgs e)
{
BancoUsuario bncusu = new BancoUsuario();
bncusu.DeletaUsu(Convert.ToInt32(this.idgrid), op);
}
public void DataGridViewUsu_CellClick(object sender, DataGridViewCellEventArgs e)
{
if (e.RowIndex >= 0)
{
DataGridViewRow row = null;
row = this.DataGridViewUsu.Rows[e.RowIndex];
BancoUsuario bncusu = new BancoUsuario();
idgrid = row.Cells["Id"].Value.ToString();
funcidgrid = row.Cells["Id Funcionario"].Value.ToString();
logingrid = row.Cells["Login"].Value.ToString();
senhagrid = row.Cells["Senha"].Value.ToString();
deletadogrid = Convert.ToInt32(row.Cells["Deletado"].Value);
}
}
private void usuVizualizar_Click(object sender, EventArgs e)
{
BancoUsuario bncusu = new BancoUsuario();
usuAdd.add_update = 2;
bncusu.buscaUsu(Convert.ToInt32(idgrid), Convert.ToInt32(funcidgrid), ref logingrid, ref senhagrid, ref deletadogrid, ref usuAdd.NomeComboBox, ref usuAdd.loginText, ref usuAdd.senhaText, usuAdd.cbAtivo.Checked);
}
}
}
Only with this code there is no help. It would be nice [Edit] and put the code
UsuarioForm
also.– Jéf Bueno
I will edit now.
– Matheus Menegatte
creation of variable "Accessed acAdd = new Accessed();"
– Matheus Menegatte