Problem Adding RadProgressBarElement to Status Strip

3 posts, 0 answers
  1. Patrick Baggett
    Patrick Baggett avatar
    9 posts
    Member since:
    Aug 2012

    Posted 20 Apr 2011 Link to this post

    I'm having problems adding a RadProgressBarElement real-time to a RadStatusStrip. When I add the progressbar to the statusstrip, it does not show.

    radProgressBarElement1.Text = "Extracting Rollback Contents"
    radProgressBarElement1.Maximum = 100; 
    radProgressBarElement1.Minimum = 0; 
    radProgressBarElement1.AutoSizeMode = RadAutoSizeMode.FitToAvailableSize; 
    radProgressBarElement1.Visibility = ElementVisibility.Visible; 
    radProgressBarElement1.Enabled = true
    // loops here and increments progress status 
    RadLabelElement1.Text = "Showing Contents of " + myDate + " Rollback File"
    radProgressBarElement1.Text = ""

    After my loop, the RadLabelElement shows in the status strip as designed.  To add to my confusion, I can also add the progressbar at this point and it shows up as well??? 

    Any idea what I'm doing wrong? 


  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 21 Apr 2011 Link to this post

    Hello Patrick,

    Here is a small example for you. I find it best to run the progress on a background worker.

    Form1 Designer
    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Partial Class Form1
        Inherits System.Windows.Forms.Form
        'Form overrides dispose to clean up the component list.
        <System.Diagnostics.DebuggerNonUserCode()> _
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
                If disposing AndAlso components IsNot Nothing Then
                End If
            End Try
        End Sub
        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer
        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Me.RadStatusStrip1 = New Telerik.WinControls.UI.RadStatusStrip()
            Me.RadButton1 = New Telerik.WinControls.UI.RadButton()
            CType(Me.RadStatusStrip1, System.ComponentModel.ISupportInitialize).BeginInit()
            CType(Me.RadButton1, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.RadStatusStrip1.AutoSize = True
            Me.RadStatusStrip1.LayoutStyle = Telerik.WinControls.UI.RadStatusBarLayoutStyle.Stack
            Me.RadStatusStrip1.Location = New System.Drawing.Point(0, 53)
            Me.RadStatusStrip1.Name = "RadStatusStrip1"
            Me.RadStatusStrip1.Size = New System.Drawing.Size(284, 26)
            Me.RadStatusStrip1.TabIndex = 0
            Me.RadStatusStrip1.Text = "RadStatusStrip1"
            Me.RadButton1.Location = New System.Drawing.Point(99, 12)
            Me.RadButton1.Name = "RadButton1"
            Me.RadButton1.Size = New System.Drawing.Size(71, 24)
            Me.RadButton1.TabIndex = 1
            Me.RadButton1.Text = "Start"
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.ClientSize = New System.Drawing.Size(284, 79)
            Me.Name = "Form1"
            Me.Text = "Form1"
            CType(Me.RadStatusStrip1, System.ComponentModel.ISupportInitialize).EndInit()
            CType(Me.RadButton1, System.ComponentModel.ISupportInitialize).EndInit()
        End Sub
        Friend WithEvents RadStatusStrip1 As Telerik.WinControls.UI.RadStatusStrip
        Friend WithEvents RadButton1 As Telerik.WinControls.UI.RadButton
    End Class

    Imports Telerik.WinControls.UI
    Imports Telerik.WinControls
    Public Class Form1
        Private m_ProgressBar As New RadProgressBarElement()
        Private m_Label As New RadLabelElement()
        Private WithEvents m_BackgroundWorker As New System.ComponentModel.BackgroundWorker()
        Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
            m_BackgroundWorker.WorkerReportsProgress = True
            m_Label.Text = "Ready"
            m_ProgressBar.MinSize = New System.Drawing.Size(200, 20)
        End Sub
        Private Sub RadButton1_Click(sender As System.Object, e As System.EventArgs) Handles RadButton1.Click
            m_Label.Visibility = ElementVisibility.Collapsed
        End Sub
        Private Sub BackgroundWorker_RunWorker(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles m_BackgroundWorker.DoWork
            For i As Integer = 0 To 100
            Next i
        End Sub
        Private Sub BackgroundWorker_ProgressChanged(sender As Object, e As System.ComponentModel.ProgressChangedEventArgs) Handles m_BackgroundWorker.ProgressChanged
            m_ProgressBar.Value1 = e.ProgressPercentage
        End Sub
        Private Sub BackgroundWorker_Complete(sender As Object, e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles m_BackgroundWorker.RunWorkerCompleted
            m_Label.Visibility = ElementVisibility.Visible
            If e.Error Is Nothing Then
                m_Label.Text = "Finished"
                m_Label.Text = e.Error.Message
            End If
        End Sub
        Private Sub ResetProgressBar(visible As Boolean)
            m_ProgressBar.Value1 = 0
            If visible Then
                m_ProgressBar.Visibility = ElementVisibility.Visible
                m_ProgressBar.Visibility = ElementVisibility.Collapsed
            End If
        End Sub
    End Class

    Hope that helps
  3. Ivan Petrov
    Ivan Petrov avatar
    701 posts

    Posted 22 Apr 2011 Link to this post

    Hello Patrick,

    Thank you for writing.

    Richard's solution is working fine on my machine. I implemented it and attached the solution for you to try. If you are still experiencing this issue, I would kindly ask you to prepare a sample project where you reproduce the issue and send it to us through a support ticket where you can attach files.

    I hope this will help. If you need further assistance, I would be glad to provide it.

    All the best,
    Ivan Petrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top