Click here to Skip to main content
12,633,764 members (32,379 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
Why is my form blinking.
when i press a button inside the form,the form will blink and not disappear, and then press the button the form will disappear .


plz,plz, Anyone Can Help Me
Posted 19-Nov-12 2:55am
Comments
Subrata_Kolkata 19-Nov-12 7:58am
   
What is the code inside button click event?
CPallini 19-Nov-12 8:08am
   
You should post the relevant code.
Krunal R 19-Nov-12 8:11am
   
Show your code..
E.F. Nijboer 19-Nov-12 8:13am
   
Try move the first window... do you see another form under it? Did you create it twice?
Nelek 19-Nov-12 17:20pm
   
Please don't think we can read minds or do astral projections to see your monitor. If you need help, the least you could do is to add some relevant code to your question or to explain your problem in such a way, that the users of CP can understand it. Otherwise, nobody will be able to help you.
what have you tried?[^]
Zain -Ul- Arifeen 21-Nov-12 6:39am
   
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Company_Accounts
{
public partial class MyMessageBox : Form
{

static MyMessageBox newMessageBox;
static string Button_id;
public static DataGridViewRow dr;
public Timer msgTimer;
int disposeFormTimer;
public MyMessageBox()
{
InitializeComponent();
}

private void MyMessageBox_Load(object sender, EventArgs e)
{
ControlBox = false;
disposeFormTimer = 30;
newMessageBox.lblTimer.Text = disposeFormTimer.ToString();
msgTimer = new Timer();
msgTimer.Interval = 1000;
msgTimer.Enabled = true;
msgTimer.Start();
msgTimer.Tick += new System.EventHandler(this.timer1_Tick );
}
public static string ShowBox(string txtMessage, string txtTitle)
{
newMessageBox = new MyMessageBox();
newMessageBox.label3.Text = txtTitle;
newMessageBox.label1.Text = txtMessage;
newMessageBox.ShowDialog();
return Button_id;
}

private void btnlist_Click(object sender, EventArgs e)
{
newMessageBox.msgTimer.Stop();
Button_id = "3";
this.Hide();
this.Close();

}

private void btnrenter_Click(object sender, EventArgs e)
{
newMessageBox.msgTimer.Stop();
Button_id = "1";
this.Close();

}

private void btnadd_Click(object sender, EventArgs e)
{
newMessageBox.msgTimer.Stop();

Button_id = "2";
this.Close();

}

private void timer1_Tick(object sender, EventArgs e)
{
disposeFormTimer--;

if (disposeFormTimer >= 0)
{
newMessageBox.lblTimer.Text = disposeFormTimer.ToString();
}
else
{
newMessageBox.msgTimer.Stop();
newMessageBox.msgTimer.Dispose();
newMessageBox.Dispose();
}
}
}
}
this my form code.

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

Your code is making it blink. It's doing what you asked it to, and we can't help based on this vague request
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.161208.2 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100