0
Good afternoon, I am developing a system in c# where I need to find the note number and when clicking add, it passes the information to the main form in listview. Can anyone help me how to develop this? Thank you
This is my form to add note number public partial class Frmaddshipment : Form { public int iRetorno = 0;
public FrmAddRemessa()
{
InitializeComponent();
}
private void Txt_CodigoRemessa_Validating(object sender, CancelEventArgs e)
{
if (txt_CodigoRemessa.Text.Trim().Equals(string.Empty))
return;
var oNota = new RemessaNG().BuscarNota(Convert.ToInt32(txt_CodigoRemessa.Text.Trim()));
txt_CodigoCliente.Text = Convert.ToInt32(oNota.ClienteID).ToString();
txt_NotaID.Text = Convert.ToInt32(oNota.NotaID).ToString();
MascaraCampoCodigo.RetornarMascara(txt_CodigoCliente, new EventArgs());
MascaraCampoCodigo.RetornarMascara(txt_NotaID, new EventArgs());
}
private void Txt_CodigoRemessa_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
Txt_CodigoRemessa_Validating(txt_CodigoRemessa, new CancelEventArgs());
}
}
private void Txt_CodigoCliente_TextChanged(object sender, EventArgs e)
{
//Verifica se está vazio
if (txt_CodigoCliente.Text.Trim().Equals(string.Empty))
return;
var oCliente = new RemessaNG().BuscarCliente(Convert.ToInt32(txt_CodigoCliente.Text.Trim()));
txt_NomeCliente.Text = oCliente.Nome;
MascaraCampoCodigo.RetornarMascara(txt_CodigoCliente, new EventArgs());
MascaraCampoCodigo.RetornarMascara(txt_CodigoRemessa, new EventArgs());
}
private void Bt_Adicionar_Click(object sender, EventArgs e)
{
if (txt_NotaID.Text.Trim().Equals(string.Empty))
return;
iRetorno = Convert.ToInt32(txt_CodigoRemessa.Text.Trim());
}
And this is my add button in the form ` private void Bt_addressta_click(Object Sender, Eventargs and) {
var frmAddRemessa = new FrmAddRemessa();
frmAddRemessa.ShowDialog();
var iRetorno = frmAddRemessa.iRetorno;
//iRetorno = 0
if (iRetorno < 1)
return;
}`
Wilson, it worked perfectly! Thank you so much for your help
– Rayanne Borges
@Rayanneborges, if you helped solve the problem, mark the answer as a solution to the question! ;)
– Wilson Faustino