[ Foro de C# ]

CAMBIAR UN CONTROL DESDE UNA CLASE APARTE

15-Apr-2016 00:48
Invitado (DUDA CON CLASES Y FUNCIONES)
1 Respuestas

COMO PUEDO HACER QUE UNA FUNCIÓN EN UNA CLASE, PUEDA DEVOLVER UN RESULTADO EN UN CONTROL EN UN FORMULARIO.

ESTA ES MI FUNCIÓN QUE ESTA EN MI CLASE FUNCIONES NO ME MARCA ERROR PERO TAMPOCO HACE ALGÚN RESULTADO EN LOS CONTROLES DE MI FORM1


public void obtenerip()
       {
           Hunucma ip1 = new Hunucma();
           Form1 prin1 = new Form1();
           Ping Pings = new Ping();

           MessageBox.Show(ip1.huntextBox1.Text);
           IPStatus status;
           if (Pings.Send(ip1.huntextBox1.Text).Status == IPStatus.Success)
           {
               
               status = Pings.Send(ip1.huntextBox1.Text).Status;
               prin1.label1.Text = "Terminal Conectada";
               prin1.Hunucmatpv1.Image = Image.FromFile(@"C:\Users\ANALISTA\Documents\Visual Studio 2013\Projects\WindowsFormsApplication4\estatusAA.gif");

           }
           else
           {
               status = Pings.Send(ip1.huntextBox1.Text).Status;
               prin1.label1.Text = status.ToString() + " !!!";
               prin1.Hunucmatpv1.Image = Image.FromFile(@"C:\Users\ANALISTA\Documents\Visual Studio 2013\Projects\WindowsFormsApplication4\estatusBB.gif");
           }
       }


16-Apr-2016 16:59
Nacho Cabanes (+83)

Como los elementos visuales de Forms1 serán privados, puedes crearte métodos "Get" públicos que te permitan acceder a ellos.






(No se puede continuar esta discusión porque tiene más de dos meses de antigüedad. Si tienes dudas parecidas, abre un nuevo hilo.)