Thanks for your help.
Today, I managed to settle by doing the following:
on Form1 I added inside my method:
public void logar()
{
c_consulta.sqlconexão();
SqlConnection sqlcon = new SqlConnection(c_consulta.sqltring);
usu = textBox1.Text;
pass = textBox2.Text;
int ret_eid = trazerid.retorna_eid(usu, pass);
int ret_uid = trazerid.retorna_uid(usu, pass);
//idchange(ret_eid, ret_uid);
Tinicial telamenu = new Tinicial(ret_eid,ret_uid);
telamenu.Show();
}
In form2 I added in the constructor:
public Tinicial(int ret_eid, int ret_uid)
{
InitializeComponent();
label7.Text = Convert.ToString(ret_eid);
dados_cliente(ret_eid);
dados_usuario(ret_uid);
}
It worked, though, I know it’s not the best way to do it, right? I’ll try threading. if they could advance me some good text on, I would be glad.
Thanks people
It seems to me that you are learning to program the flow of an application with graphical interface. To help, try telling the real story of what you need to do. For example: do you need a "Wizard" (sequence of forms asking the user for information)? Or form2 is the result of processing Form1 (as if the first were a filter)?
– Caffé
@Caffé is right. You need to form your question better and say, for example, if these Forms are created in the same thread. If form2 is called by Form1 it is easy, for example if processing is finished before calling form2 this result can be used as parameter. If form2 is called before the processing is finished this can check (from time to time?) a public property of Form1 (set by the processing result). Already working with threads is kind of tricky for a beginner. Anyway it depends a lot on your scenario.
– jean
thank you very much for the comments, yes I’m beginning to venture into the world of programming, so I’m performing a login screen, which consults a bank where I have the information of my users, if successfully logged in, it sends me to a form2, where I have company information, and registered equipment, however, I need two information from Form1, id-user, and id-company, because in form2, I have a table that brings me which equipment is registered for that company, and I need the user id.
– Thomas Erich Pimentel