simple databinding using the progressbar

Discussion in 'MCAD' started by coderazor, Feb 7, 2005.

  1. coderazor

    coderazor Guest

    Hi,

    I'm on the DataBinding chapter in Kalani's Windows 316 book, page 396

    It says that you can use databinding to "show the relative magnitude of
    quantities with the Value property of a ProgressBar control."

    I've been messing around in code trying make this to happen with no success.
    I've been using the timer control to generate the progress bar.

    Here is my code:

    private void timer1_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
    {
    progressBar1.Increment(5);
    this.progValue = progressBar1.Value;
    label1.DataBindings.Add("Text",this.progValue,"");
    }

    I get this error:
    This would cause two bindings int he collection to bind to the same
    property.

    Can anyone provide an example that shows how the progress bar could be used
    in simple data binding.

    .... I'm a little muddled!
     
    coderazor, Feb 7, 2005
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.