Hi babukumarasamy-5694,
Based on your code, this may be a threading problem.
And I suggest you use a BackgroundWorker which makes thread-safe calls to Windows Forms controls.
Here is a code example you can refer to.
private void Form1_Load(object sender, EventArgs e)
{
backgroundWorker1.RunWorkerAsync();
}
private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
webBrowser1.Left = 0;
webBrowser1.Top = 0;
Screen scr = Screen.PrimaryScreen;
webBrowser1.Width = scr.Bounds.Width;
int iHeight = scr.Bounds.Height;
iHeight = iHeight + 50;
webBrowser1.Height = iHeight;
}
Here is a related document you can refer to.
Best Regards,
Daniel Zhang
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.