0
I’m making a parking system, in which arose the need for when the user register, in the main form appear to an icon of a car on top of his vacancy (which is a label), ie when he click the 'register' buttonif' in the other form, the main form has to appear a car icon on top of its wave!
i tried it as follows, at the click of the sign-up form button I instated a constructor of the main form, and in the constructor of the main form, I passed the image that should go to the label, however it did not work!
//Click the sign up button, the registration form, first I create the object then I instate the Form1
private void button1_Click(object sender, EventArgs e)
{
Cadastro cadObj = new Cadastro(Convert.ToString(horas), txt_placa.Text, txt_cor.Text, txt_modelo.Text);
var formulario1 = new Form1(Properties.Resources.vermelho);
btn_registrar.Enabled = false;
}
//Constructor of the main form that is called at the click of the sign up button
public Form1(System.Drawing.Image imagem)
{
InitializeComponent();
box15.Image = imagem;
}
I just need when I click register the icone of a car go to the label, to reference that there is someone already in the vacancy!
Why didn’t it work?
– Jéf Bueno
Also do not know, I believe that maybe because I am instantiating a new object and I actually have to do this in the current object that is created when the form opens finally.. I’m not sure, but I’ve changed my mind, figure out a way to do everything in one form, work with Forms in visual studio is an ass!!!
– eborelli
Okay, I still don’t understand what the problem is. " It didn’t work" is very abstract, we need to know what happens, what the expected behavior and what the problem is. About your last sentence, it’s just because you can’t work, it’s all very simple.
– Jéf Bueno
it was expected that the label that is in the other form(main), received the parameter(photo) passed when clicking the button to register, and that when it receives the parameter that this label assigns this photo to its delimited area, however when I do this, nothing happens, not error, and it doesn’t work either! I don’t know if I’ve been able to clear up my problem, but I hope so!
– eborelli
"but when I do, nothing happens" -> By that you mean that the form does not open? Or that it does not show the icon as you want?
– Jéf Bueno