And I have a question here about programming in C #, which I'm not sure how to do.
Well, I'm first with a Windows Form Application C # program, in it I created 2 forms, form1 being the main one, where there is a menu that would be to choose as if it were a script, in general the whole project would be for log in to a user and password at a given internet URL.
But that's it, and in form1, I put 4 radiobutton, and in these radiobutton each one should contain a registration and password. And I even put a button to start that script. And when it was clicked on that button to start it calls form2, which was placed in the WebBrowser component.
Until quoted above is ok. My doubts would be as follows. I wanted to know some method of getting the value of the radiobutton back to the other form by clicking the start button. In the part of the radiobutton would be a code in the example below, containing the two values and taking the option that is checked, however I wanted to know how I would make the return of this value to go in another form that would be used in the WebBrowser component.
if (radioButton0.Checked)
{
rb_matricula = 8020137; //André Venicios
rb_senha = "senha0";
}
else if (radioButton1.Checked)
{
rb_matricula = 7011288; //Clériston Morais Santos
rb_senha = "senha1";
}
else if (radioButton2.Checked)
{
rb_matricula = 5010940; //Daniel Ribeiro Bandeira
rb_senha = "senha2";
}
My start script button only put the same redirect to form2
private void btn_Iniciar_Click(object sender, EventArgs e)
{
frmBrowser navegador = new frmBrowser();
navegador.ShowDialog();
}
Good now going to form2, it will start the WebBrowser component already in the following link
webBrowser1.Navigate("https://172.16.0.47/pessoal/");
Once that's done, I've put it in to get some data from the existing site URL. And fill this field with the value selected in the radiobutton of form1, which would be this field.
bool pWeb = false;
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
if(!pWeb)
{
webBrowser1.Document.GetElementById("usu_login").InnerText = "7011288";
webBrowser1.Document.GetElementById("usu_senha").InnerText = "senha1";
}
pWeb = true;
}
And the final doubt would be to get the value returned from the radiobutton, and put in the place where the registration and the password are. after InnerText, arranging another method to pass it, after it takes the element by the ID and inserts it.
If someone can help me with this question, I will be very grateful, as I caught in this way how I will pass it and what method I could use to put it in place of InnerText.