2
Answers

Passing Data Between Forms

Sousa Pambo

Sousa Pambo

10y
959
1
Hi fellows, I need your help.
I'm trying to pass datas from one form to other. Please, see my code....
 
//The datas are to this form (see mainly the bolded lines)
 
public partial class frmAtribuirFalta : Form
{
public frmAtribuirFalta()
{
InitializeComponent();
}
DAL.Funcionario FuncDal = new DAL.Funcionario();
DAL.ConexaoGeral CG = new DAL.ConexaoGeral();
private int numHoras;
private int FaltaAnulada = 0;
private int FaltaJustify = 0;
private int porDescont = 0;
private int processada = 0;
// Tipo de Falta 1- Horas, 2-Dias, 3 - Semanas, 4 - Meses
private int tipoFalta;
public DateTime data;
private void btFecha_Click(object sender, EventArgs e)
{
this.Close();
}
public string IDSet
{
set { tb_IdFunc.Text = value; }
}

public string NomeSet
{
set { lbNomeFunc.Text = value; }
}
private void bt_Search_Click(object sender, EventArgs e)
{
if (tb_IdFunc.Text == "")
{
frmSearchFunc SF = new frmSearchFunc();
SF.Location = new System.Drawing.Point(CG.parameterXLocation(), CG.parameterYLocation());
SF.ShowDialog();
}
else
{ FuncDal.shearchbyIDGeral(lstFalta, tb_IdFunc.Text); }
}
}
}
________________________________________________________________________________________________
I want to get data from this form (see mainly the bolded lines)
 
public partial class frmSearchFunc : Form
{
DAL.Funcionario FuncDal = new DAL.Funcionario();
DAL.ConexaoGeral cn = new DAL.ConexaoGeral();
public ArrayList arrayDetail = new ArrayList();
//string idProp;
//string nomeProp;
public frmSearchFunc()
{
InitializeComponent();
}
private void btFecha_Click(object sender, EventArgs e)
{
this.Close();
}
public string dadosID
{
//get { return idProp; }
get { return lstSearchFuncGeral.FocusedItem.SubItems[0].Text; }
}

public string dadosNome
{
//get { return nomeProp; }
get { return lstSearchFuncGeral.FocusedItem.SubItems[1].Text; }
}
private void tb_Func_TextChanged(object sender, EventArgs e)
{
if (tb_Func.Text.Length >= 3)
{
FuncDal.shearchbyNameGeral(this.lstSearchFuncGeral, tb_Func.Text.Trim());
//tb_IdFunc.Enabled = false;
//this.bt_Pesquisa.Enabled = false;
//this.lbIdFunc.Text = "";
}
}
private void lstSearchFuncGeral_DoubleClick(object sender, EventArgs e)
{
frmAtribuirFalta atribF = new frmAtribuirFalta();

if (atribF.Visible == true)
{
//arrayDetail = FuncDal.FuncAllData(this.lstSearchFuncGeral.FocusedItem.SubItems[0].Text);
//nomeProp = arrayDetail[0].ToString().Trim() + " " + arrayDetail[17].ToString().Trim();
atribF.IDSet = dadosID;
atribF.NomeSet = dadosNome;
}

this.Close();
}
private void frmSearchFunc_Load(object sender, EventArgs e)
{
// MessageBox.Show("" + arrayDetail[0].ToString().Trim());
}
}
}
 
Please help........ 
 
 

Answers (2)
Next Recommended Forum