Click here to Skip to main content
15,886,199 members
Home / Discussions / C#
   

C#

 
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 
QuestionOpen Ms Access Reports in Win Form Pin
Abdul Rahman Hamidy9-Oct-09 23:41
Abdul Rahman Hamidy9-Oct-09 23:41 
AnswerRe: Open Ms Access Reports in Win Form Pin
Dave Kreskowiak10-Oct-09 3:14
mveDave Kreskowiak10-Oct-09 3:14 
AnswerRe: Open Ms Access Reports in Win Form Pin
Md. Marufuzzaman10-Oct-09 3:43
professionalMd. Marufuzzaman10-Oct-09 3:43 
Questionreading bios information in c# Pin
Fred 349-Oct-09 23:38
Fred 349-Oct-09 23:38 
AnswerRe: reading bios information in c# Pin
stancrm10-Oct-09 1:00
stancrm10-Oct-09 1:00 
GeneralRe: reading bios information in c# Pin
Fred 3410-Oct-09 9:14
Fred 3410-Oct-09 9:14 
AnswerRe: reading bios information in c# Pin
Richard MacCutchan10-Oct-09 2:42
mveRichard MacCutchan10-Oct-09 2:42 
GeneralRe: reading bios information in c# Pin
Fred 3410-Oct-09 9:12
Fred 3410-Oct-09 9:12 
GeneralRe: reading bios information in c# Pin
Richard MacCutchan10-Oct-09 21:27
mveRichard MacCutchan10-Oct-09 21:27 
QuestionDataGrid Pin
Yonathan11119-Oct-09 22:29
professionalYonathan11119-Oct-09 22:29 
AnswerRe: DataGrid Pin
Suresh Suthar9-Oct-09 22:40
professionalSuresh Suthar9-Oct-09 22:40 
Questionwindow above everything else including taskbar + start-button? Pin
FocusedWolf9-Oct-09 20:08
FocusedWolf9-Oct-09 20:08 
AnswerRe: window above everything else including taskbar + start-button? [modified] Pin
FocusedWolf11-Oct-09 17:47
FocusedWolf11-Oct-09 17:47 
QuestionAuto generate numbers in listview? Pin
avirag9-Oct-09 18:55
avirag9-Oct-09 18:55 
AnswerRe: Auto generate numbers in listview? Pin
OriginalGriff9-Oct-09 22:24
mveOriginalGriff9-Oct-09 22:24 

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.