Link to home
Create AccountLog in
Avatar of MrTV
MrTVFlag for Thailand

asked on

c# loop

    webBrowser1.Navigate(new Uri(urls[0]));
                webBrowser1.Dock = DockStyle.Fill;
                webBrowser2.Navigate(new Uri(urls[1]));
                webBrowser2.Dock = DockStyle.Fill;
                webBrowser3.Navigate(new Uri(urls[2]));
                webBrowser3.Dock = DockStyle.Fill;
                webBrowser4.Navigate(new Uri(urls[3]));
                webBrowser4.Dock = DockStyle.Fill;

it like all of  url in web control is the same it is the last one from query how can i fix it to each row that it can read from db
{
            string MyConString = "SERVER=192.168.0.78;" +
                 "DATABASE=webboard;" +
                 "UID=aimja;" +
                 "PASSWORD=aimjawork;" +
                 "charset=utf8;";
            MySqlConnection connection = new MySqlConnection(MyConString);
            MySqlCommand command = connection.CreateCommand();
            MySqlDataReader Reader;
            command.CommandText = "SELECT  urlwebboard FROM `listweb` WHERE `urlwebboard` IS NOT NULL AND ( `webbordkind` = '¿¿¿¿¿¿¿¿¿¿¿¿' ) and `nourl`= 'n' order by province, amphore limit 4 ";
            connection.Open();
            Reader = command.ExecuteReader();

            
            string[] urls = new string[4];
            string thisrow = "";
            string sumthisrow = "";
            string urlname ;
            while (Reader.Read())
            {
                thisrow = "";
                sumthisrow = "";
                for (int i = 0; i < Reader.FieldCount; i++)
                {
                    thisrow += Reader.GetValue(i).ToString();
                   

                

                    System.IO.File.AppendAllText(@"C:\file.txt", thisrow + " " + Environment.NewLine);
                    sumthisrow =  thisrow;

                }

               


            }
            for (int i = 0; i < 4; i++)
            {
                urls[i] = sumthisrow;
                webBrowser1.Navigate(new Uri(urls[0]));
                webBrowser1.Dock = DockStyle.Fill;
                webBrowser2.Navigate(new Uri(urls[1]));
                webBrowser2.Dock = DockStyle.Fill;
                webBrowser3.Navigate(new Uri(urls[2]));
                webBrowser3.Dock = DockStyle.Fill;
                webBrowser4.Navigate(new Uri(urls[3]));
                webBrowser4.Dock = DockStyle.Fill;

            }
            connection.Close();

Open in new window

SOLUTION
Avatar of Dennis Aries
Dennis Aries
Flag of Netherlands image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account