Quantcast
Channel: C#nedir?com Forum
Viewing all articles
Browse latest Browse all 613

Visual C# : For Döngüsü Problemi

$
0
0
Author: shasha
Subject: For Döngüsü Problemi
Posted: 19 Ağustos 2016 at 01:38

 private void button2_Click_1(object sender, EventArgs e)
        {
             
            
            for (sayac = 0; sayac < dataGridView1.RowCount; sayac++)
              
            {

             //   MessageBox.Show(sayac.ToString());
 if (dataGridView1.Rows[sayac].Cells[0].Value == null || dataGridView1.Rows[sayac].Cells[0].Value.Equals(""))
                  {
                      Application.DoEvents();
                 
                   }

                  else

                   {


                       var tc = dataGridView1.Rows[sayac].Cells[0].Value.ToString();

             
               
            //              MessageBox.Show(tc);
                      
    

                if (this.wb1.ReadyState != WebBrowserReadyState.Complete)
                    Application.DoEvents();
                else
                {
 
                  
                    
                  

                    if (wb1.Url.ToString() == "//192.168.1.220/local.aspx")
                    {
                   
                        wb1.Document.GetElementById("ContentPlaceHolder1_TC").SetAttribute("value", tc);
                        wb1.Document.GetElementById("ContentPlaceHolder1_Button1").InvokeMember("click");
 
                    }
                }
                   }
 }
        }
    }



 private void wb1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
        {

            textBox1.Text = wb1.Url.ToString();

            try
            {

                gelenad = wb1.Document.GetElementById("ContentPlaceHolder1_BorcluAdi").GetAttribute("value");
                gelensoyad = wb1.Document.GetElementById("ContentPlaceHolder1_BorcluSoyAdi").GetAttribute("value");
                gelendogum = wb1.Document.GetElementById("ContentPlaceHolder1_FoyNo").GetAttribute("value");

                dataGridView1.Rows[sayac-1].Cells[1].Value = gelenad;
                dataGridView1.Rows[sayac-1].Cells[2].Value = gelensoyad;
                dataGridView1.Rows[sayac-1].Cells[3].Value = gelenFoyNo;
                wb1.Navigate("//192.168.1.220/local.aspx");
         }


            catch
            {

            }

        }

bir türlü verileri düzgün alamıyorum
localden webbrowser ile sayfa açtırılıp veri girilip sorgu sonucunu almak istiyorum fakat
bir türlü beceremiyorum

bu kodlar      //   MessageBox.Show(sayac.ToString()); olduğunda düzgün çalışıyor 
fakat kaldırınca çalışmıyor ?


Viewing all articles
Browse latest Browse all 613

Latest Images

Trending Articles



Latest Images