Click here to Skip to main content
15,902,114 members
Home / Discussions / C#
   

C#

 
GeneralTAPI Pin
rpussewela19-Oct-04 4:41
rpussewela19-Oct-04 4:41 
GeneralRe: TAPI Pin
Dave Kreskowiak19-Oct-04 8:33
mveDave Kreskowiak19-Oct-04 8:33 
GeneralRe: TAPI Pin
rpussewela19-Oct-04 20:38
rpussewela19-Oct-04 20:38 
GeneralRe: TAPI Pin
Nick Parker19-Oct-04 12:45
protectorNick Parker19-Oct-04 12:45 
GeneralUI Thread Pin
eDip19-Oct-04 4:39
eDip19-Oct-04 4:39 
GeneralRe: UI Thread Pin
Stefan Troschuetz19-Oct-04 5:08
Stefan Troschuetz19-Oct-04 5:08 
GeneralRe: UI Thread Pin
Michael Potter19-Oct-04 5:10
Michael Potter19-Oct-04 5:10 
GeneralRe: UI Thread Pin
eDip20-Oct-04 0:11
eDip20-Oct-04 0:11 
I have created an application. Here I am giving the code for the form file in the application in which I am trying to show a new form when the timer expires after 2 seconds. But the form is not displayed properly. When the button on the form is clicked it properly shows a new form. So please let me know what is going wrong here?And how to correct that.

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Timers;
using System.Threading;
using System.Windows.Forms.Design;

namespace WindowsApplication1
{
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;

public Form1()
{
InitializeComponent();
}

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(120, 152);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}
#endregion

///
/// The main entry point for the application.
///

[STAThread]
static void Main()
{
// Create a new Timer with Interval set to 2 seconds.
System.Timers.Timer aTimer = new System.Timers.Timer(2000);
aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);

// Only raise the event the first time Interval elapses.
aTimer.AutoReset = false;
aTimer.Enabled = true;

Form1 oForm1 = new Form1();
Application.Run(oForm1);
}

// Specify what you want to happen when the event is raised.
private static void OnTimedEvent(object source, ElapsedEventArgs e)
{
Form1 oForm1 = new Form1();
oForm1.Show();
}

private void button1_Click(object sender, System.EventArgs e)
{
//fnCreate();
Form1 oForm1 = new Form1();
oForm1.Show();
}
}
}
GeneralRe: UI Thread Pin
Michael Potter20-Oct-04 4:06
Michael Potter20-Oct-04 4:06 
GeneralRe: UI Thread Pin
eDip21-Oct-04 5:34
eDip21-Oct-04 5:34 
GeneralRe: UI Thread Pin
Michael Potter21-Oct-04 6:10
Michael Potter21-Oct-04 6:10 
Generalatrribute Pin
hagay_ar19-Oct-04 4:24
hagay_ar19-Oct-04 4:24 
General.Net Remoting Windows Service Server Pin
mablao19-Oct-04 4:23
mablao19-Oct-04 4:23 
GeneralRe: .Net Remoting Windows Service Server Pin
mav.northwind19-Oct-04 5:14
mav.northwind19-Oct-04 5:14 
GeneralRe: .Net Remoting Windows Service Server Pin
C LaMorticella15-Nov-04 6:21
C LaMorticella15-Nov-04 6:21 
Generalinserting to db using access db Pin
_sercher_19-Oct-04 4:20
_sercher_19-Oct-04 4:20 
GeneralDatabinding need help Pin
fortyonejb19-Oct-04 3:53
fortyonejb19-Oct-04 3:53 
GeneralRe: Databinding need help Pin
Christian Graus19-Oct-04 9:44
protectorChristian Graus19-Oct-04 9:44 
GeneralRe: collection question Pin
isittheweekendyet19-Oct-04 3:45
isittheweekendyet19-Oct-04 3:45 
GeneralRe: collection question Pin
sreejith ss nair19-Oct-04 5:09
sreejith ss nair19-Oct-04 5:09 
GeneralRe: collection question Pin
sreejith ss nair19-Oct-04 5:09
sreejith ss nair19-Oct-04 5:09 
Generaldelete string-value Pin
mathon19-Oct-04 3:32
mathon19-Oct-04 3:32 
GeneralDataGrid "Special Key" Confusion Pin
RockmanHero200319-Oct-04 2:00
RockmanHero200319-Oct-04 2:00 
GeneralOverride Pin
Anonymous19-Oct-04 1:42
Anonymous19-Oct-04 1:42 
GeneralRe: Override Pin
Colin Angus Mackay19-Oct-04 2:11
Colin Angus Mackay19-Oct-04 2:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.