Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8620877
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:41:11+00:00 2026-06-12T06:41:11+00:00

private void Form2_Load(object sender, EventArgs e) { con1.Open(); Form1 home = new Form1(); home.MdiParent

  • 0
private void Form2_Load(object sender, EventArgs e)
    {
        con1.Open();

        Form1 home = new Form1();
        home.MdiParent = this.MdiParent ;

        System.Timers.Timer timer1 = new System.Timers.Timer();
        Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyComputer)  + @"\\server1\KamalSingh\ScreenCaptures");
        t.Interval  = 500;
        t.Tick += new EventHandler(StartThread);
        t.Start();
     }


   System.Windows.Forms.Timer t = new  System.Windows.Forms.Timer();
   //Thread tt;   

   private static Bitmap bmpscreenshot;
   private static Graphics gfxscreenshot;

    void TakeScreenShot()
    {

        bmpscreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height,PixelFormat.Format32bppArgb);
        gfxscreenshot = Graphics.FromImage(bmpscreenshot );
        gfxscreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,Screen.PrimaryScreen.Bounds.Y,0,0,Screen.PrimaryScreen.Bounds.Size,CopyPixelOperation.SourceCopy );
        bmpscreenshot.Save(Environment.GetFolderPath(Environment.SpecialFolder.MyComputer) +@"\\server1\KamalSingh\ScreenCaptures\.bmp", ImageFormat.Png);
      //  tt.Abort();
    }

     protected  void StartThread(object sender, EventArgs e)
     {
         Thread th  = new Thread(new ThreadStart(TakeScreenShot));
         th.SetApartmentState(ApartmentState.STA );
         th.Start();
         Thread.Sleep(100);
         th.Join();

     }

I want to fix this error that occurs when I am executing my program. The error comes after some time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T06:41:12+00:00Added an answer on June 12, 2026 at 6:41 am

    Try this:

    void TakeScreenShot()
    {
    
        using(Bitmap bmpscreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width,Screen.PrimaryScreen.Bounds.Height,PixelFormat.Format32bppArgb))
        {
            using(Graphics gfxscreenshot = Graphics.FromImage(bmpscreenshot))
            {
                gfxscreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X,Screen.PrimaryScreen.Bounds.Y,0,0,Screen.PrimaryScreen.Bounds.Size,CopyPixelOperation.SourceCopy );
                bmpscreenshot.Save(Environment.GetFolderPath(Environment.SpecialFolder.MyComputer) +@"\\server1\KamalSingh\ScreenCaptures\.bmp", ImageFormat.Png);
            }
        }
    }
    

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please, what is wrong with this: private void Form2_Load(object sender, EventArgs e) { switch
public class Form1 : System.Windows.Forms.Form { private void eachCornerPix (object sender, PaintEventArgs e, out
private void Form1_Load(object sender, System.EventArgs e) { StartToFillTree(); } private void StartToFillTree( ) {
partial class Form1 { //hidden private void InitializeComponent() { this.picture = new System.Windows.Forms.PictureBox(); //hidden
. private void Form1_Load(object sender, EventArgs e) { List<CaclulatedData> tests = new List<CaclulatedData> {
int a, b; private void Form1_Load(object sender, EventArgs e) { this.Width = 600; this.Height
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { if (MessageBox.Show(this,
private void button1_Click(object sender, EventArgs e) { for (int i = 0; i <
private void SaveAsPicture_Click(object sender, RoutedEventArgs e) { WriteableBitmap bmp = new WriteableBitmap(MyUIElement, null); var
I have a problem with DragDrop. private void Form0_Load(object sender, EventArgs e) { PictureBox

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.