Click here to Skip to main content
16,011,626 members
Home / Discussions / C#
   

C#

 
QuestionCan't Break point ASP Project Pin
smarttom9912-Oct-07 5:09
smarttom9912-Oct-07 5:09 
AnswerRe: Can't Break point ASP Project Pin
martin_hughes12-Oct-07 5:21
martin_hughes12-Oct-07 5:21 
GeneralRe: Can't Break point ASP Project Pin
smarttom9913-Oct-07 4:29
smarttom9913-Oct-07 4:29 
GeneralRe: Can't Break point ASP Project Pin
martin_hughes13-Oct-07 6:03
martin_hughes13-Oct-07 6:03 
QuestionModal Dialogs Pin
Skippums12-Oct-07 5:05
Skippums12-Oct-07 5:05 
AnswerRe: Modal Dialogs Pin
TJoe12-Oct-07 6:13
TJoe12-Oct-07 6:13 
GeneralRe: Modal Dialogs Pin
Skippums12-Oct-07 6:27
Skippums12-Oct-07 6:27 
GeneralRe: Modal Dialogs [modified] Pin
Fayu12-Oct-07 7:22
Fayu12-Oct-07 7:22 
I would suggest that you create delegates/events to accomplish this. for example:

to show progress :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace WindowsApplication1
{
public partial class Form1 : Form
{
Import imp = new Import();
public Form1()
{
InitializeComponent();

imp.ProgressChanged += new ProgressChangedEventHandler(imp_ProgressChanged);
}




protected void imp_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
this.progressBar1.Maximum = e.Total;
this.progressBar1.Value = e.CurrentProgress;
}

private void button1_Click(object sender, EventArgs e)
{
Thread thrd = new Thread(new ThreadStart(imp.Start));
thrd.Start();
}
}
}

//Your Delegate
public delegate void ProgressChangedEventHandler(object sender, ProgressChangedEventArgs e);

//Your ProgressChangedEventArgs event
public class ProgressChangedEventArgs : EventArgs
{
//Fields
private int _currentProgress;
private int _total;

//Constructors
public ProgressChangedEventArgs(int currentProgress, int total)
{
this._currentProgress = currentProgress;
this._total = total;
}

//Properties
public int CurrentProgress
{
get { return this._currentProgress; }
}
public int Total
{
get { return this._total; }
}
}

//Import Class
public class Import
{
//Events
public ProgressChangedEventHandler ProgressChanged;


//Method
public void Start()
{
int tot = 1000;

for (int i = 0; i < tot; i++)
{
OnProgressChanged(this, new ProgressChangedEventArgs(i, tot));
Thread.Sleep(100);
}
}
//Event Method
protected void OnProgressChanged(object sender, ProgressChangedEventArgs e)
{
ISynchronizeInvoke sync = (ISynchronizeInvoke)this.ProgressChanged.Target;

if (sync.InvokeRequired) {
ProgressChangedEventHandler tmp = new ProgressChangedEventHandler(OnProgressChanged);
object[] args ={ sender, e };
sync.Invoke(tmp, args);
return;
}
if (ProgressChanged != null)
ProgressChanged(sender, e);
}
}



-- modified at 13:28 Friday 12th October, 2007
QuestionRe: Modal Dialogs Pin
Skippums12-Oct-07 7:02
Skippums12-Oct-07 7:02 
AnswerRe: Modal Dialogs Pin
Luc Pattyn12-Oct-07 7:20
sitebuilderLuc Pattyn12-Oct-07 7:20 
GeneralRe: Modal Dialogs Pin
Skippums12-Oct-07 7:59
Skippums12-Oct-07 7:59 
AnswerRe: Modal Dialogs Pin
Luc Pattyn12-Oct-07 7:53
sitebuilderLuc Pattyn12-Oct-07 7:53 
QuestionBase data Pin
RussBus12-Oct-07 4:51
RussBus12-Oct-07 4:51 
AnswerRe: Base data Pin
led mike12-Oct-07 4:57
led mike12-Oct-07 4:57 
GeneralRe: Base data Pin
RussBus12-Oct-07 5:02
RussBus12-Oct-07 5:02 
AnswerRe: Base data Pin
Skippums12-Oct-07 5:21
Skippums12-Oct-07 5:21 
GeneralRe: Base data Pin
RussBus12-Oct-07 5:43
RussBus12-Oct-07 5:43 
GeneralRe: Base data Pin
RussBus12-Oct-07 5:57
RussBus12-Oct-07 5:57 
GeneralRe: Base data Pin
Skippums12-Oct-07 5:58
Skippums12-Oct-07 5:58 
QuestionHow to count imgae files in a folder Pin
Member 46302412-Oct-07 4:50
Member 46302412-Oct-07 4:50 
AnswerRe: How to count imgae files in a folder Pin
led mike12-Oct-07 4:54
led mike12-Oct-07 4:54 
AnswerRe: How to count imgae files in a folder Pin
Jacky Yiu12-Oct-07 5:01
Jacky Yiu12-Oct-07 5:01 
GeneralRe: How to count imgae files in a folder Pin
Member 46302412-Oct-07 5:31
Member 46302412-Oct-07 5:31 
GeneralRe: How to count imgae files in a folder Pin
Jacky Yiu13-Oct-07 1:15
Jacky Yiu13-Oct-07 1:15 
GeneralRe: How to count imgae files in a folder Pin
Member 46302413-Oct-07 10:34
Member 46302413-Oct-07 10:34 

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.