Click here to Skip to main content
15,897,187 members
Home / Discussions / C#
   

C#

 
GeneralRe: Don't convert to the nearest decimal Pin
Luc Pattyn10-Oct-09 6:22
sitebuilderLuc Pattyn10-Oct-09 6:22 
Questionsecurity in exe for .net Pin
sina62ir10-Oct-09 3:45
sina62ir10-Oct-09 3:45 
AnswerRe: security in exe for .net Pin
Arindam Sinha10-Oct-09 4:22
Arindam Sinha10-Oct-09 4:22 
AnswerRe: security in exe for .net Pin
Henry Minute10-Oct-09 6:09
Henry Minute10-Oct-09 6:09 
GeneralRe: security in exe for .net Pin
SimpleData11-Oct-09 1:58
SimpleData11-Oct-09 1:58 
Question64-bit Jet OLEDB Provider Pin
hbehar10-Oct-09 2:00
hbehar10-Oct-09 2:00 
AnswerRe: 64-bit Jet OLEDB Provider Pin
Richard MacCutchan10-Oct-09 2:36
mveRichard MacCutchan10-Oct-09 2:36 
AnswerRe: 64-bit Jet OLEDB Provider Pin
Dave Kreskowiak10-Oct-09 3:11
mveDave Kreskowiak10-Oct-09 3:11 
Questioninsert URL to trusted sites llist Pin
hbehar10-Oct-09 1:31
hbehar10-Oct-09 1:31 
AnswerRe: insert URL to trusted sites llist Pin
harold aptroot10-Oct-09 2:14
harold aptroot10-Oct-09 2:14 
GeneralRe: insert URL to trusted sites llist Pin
hbehar10-Oct-09 2:26
hbehar10-Oct-09 2:26 
GeneralRe: insert URL to trusted sites llist Pin
harold aptroot10-Oct-09 2:32
harold aptroot10-Oct-09 2:32 
AnswerRe: insert URL to trusted sites llist Pin
Dave Kreskowiak10-Oct-09 3:13
mveDave Kreskowiak10-Oct-09 3:13 
AnswerRe: insert URL to trusted sites llist Pin
Md. Marufuzzaman10-Oct-09 3:27
professionalMd. Marufuzzaman10-Oct-09 3:27 
Questionalter data type in sql table column Pin
prakashamnkl10-Oct-09 0:47
prakashamnkl10-Oct-09 0:47 
AnswerRe: alter data type in sql table column Pin
stancrm10-Oct-09 1:00
stancrm10-Oct-09 1:00 
AnswerRe: alter data type in sql table column Pin
Md. Marufuzzaman10-Oct-09 3:17
professionalMd. Marufuzzaman10-Oct-09 3:17 
Questionuse of custom validation Pin
atiskumar10-Oct-09 0:43
atiskumar10-Oct-09 0:43 
AnswerRe: use of custom validation Pin
stancrm10-Oct-09 1:01
stancrm10-Oct-09 1:01 
Questionprogress bar Pin
Member 5903109-Oct-09 23:43
Member 5903109-Oct-09 23:43 
AnswerRe: progress bar Pin
OriginalGriff10-Oct-09 0:09
mveOriginalGriff10-Oct-09 0:09 
GeneralRe: progress bar Pin
SimpleData10-Oct-09 8:53
SimpleData10-Oct-09 8:53 
AnswerRe: progress bar Pin
DaveyM6910-Oct-09 0:17
professionalDaveyM6910-Oct-09 0:17 
Either:
1. Wherever you're setting the Value of the progress bar, also call ToString() on the value and set that as the text box's Text
2. Use your own class that derives from ProgressBar and create a ProgressChanged event. Then, subscribe to that and update your text box in the handler. Something like:
C#
using System;
using System.Windows.Forms;

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
        myProgressBar.ProgressChanged += myProgressBar_ProgressChanged;
        // myProgressBar.Value = 50;
    }

    void myProgressBar_ProgressChanged(object sender, EventArgs<int> e)
    {
        textBox.Text = string.Format("{0}%", e);
    }
}
public class MyProgressBar : ProgressBar
{
    public event EventHandler<EventArgs<int>> ProgressChanged;

    public new int Value
    {
        get { return base.Value; }
        set
        {
            if (value >= Minimum &&
                value <= Maximum &&
                value != base.Value)
            {
                base.Value = value;
                OnProgressChanged(new EventArgs<int>(value));
            }
        }
    }
    protected virtual void OnProgressChanged(EventArgs<int> e)
    {
        EventHandler<EventArgs<int>> eh = ProgressChanged;
        if (eh != null)
            eh(this, e);
    }
}

public class EventArgs<T> : EventArgs
{
    public EventArgs(T value)
    {
        Value = value;
    }
    public T Value
    {
        get;
        private set;
    }
    public override string ToString()
    {
        return Value.ToString();
    }
}


Dave

Generic BackgroundWorker - My latest article!
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Why are you using VB6? Do you hate yourself? (Christian Graus)

GeneralRe: progress bar Pin
Member 59031010-Oct-09 2:01
Member 59031010-Oct-09 2:01 
GeneralRe: progress bar Pin
DaveyM6910-Oct-09 3:18
professionalDaveyM6910-Oct-09 3:18 

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.