Click here to Skip to main content
15,881,588 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
So i am making a program using MetroFrameworks forms and Progressbar and i need to switch the style from Continues to Marquee after some code is ran and (progressBar = ProgressBarStyle.Marquee) dosen't work


C#
private void WebClient_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                this.DialogResult = DialogResult.No;
                this.Close();
            }
            else if (e.Cancelled)
            {
                this.DialogResult = DialogResult.Abort;
                this.Close();
            }
            else
            {
                lblProgress.Text = "Verifying Download...";
    ------->    progressBar.Style =  ProgressBarStyle.Marquee;    <---------

                bgWorker.RunWorkerAsync(new string[] { this.tempFile, this.md5 });
            }


What I have tried:

progressBar.Style = ProgressBarStyle.Marquee;
Posted
Updated 5-Sep-17 9:20am
v2
Comments
Graeme_Grant 3-Sep-17 19:02pm    
The error message is very specific. You can't fit a square peg in a round hole.

Look at the style declaration of each and you will see that the TargetType is not the same.

Also is this a WinForm or WPF app?
proff001 4-Sep-17 1:51am    
I understand that but i don't know what to use instead.
Graeme_Grant 4-Sep-17 2:02am    
We can't see your code from here so without the code we can't comment.

What is ProgressBarStyle.Marquee?

I ask again, is this a WinForm or WPF app?

Click on "Improve question" widget and supply relative source code if you want anyone to make an informed response.
proff001 4-Sep-17 2:05am    
WinForm
Graeme_Grant 4-Sep-17 2:08am    
Again, WHAT is ProgressBarStyle.Marquee?

Quote:
Error CS0266 cannot implicitly convert type 'system.windows.forms.progressbarstyle' to 'metroframework.metrocolorstyle'. An explicit conversion exists (are you missing a cast? )
First step
Read the documentation: Compiler Error CS0266 | Microsoft Docs[^]
Second step
Learn about type casting (explicit and implicit)...
Finaly
Apply your knowledge!
 
Share this answer
 
Comments
proff001 4-Sep-17 5:37am    
I just need to know what to switch out ProgressBarStyle.Marquee to a metroframework version
The Style[^] property is a MetroColorStyle[^] value, not a ProgressBarStyle value.

You're looking for the ProgressBarStyle[^] property:
progressBar.ProgressBarStyle = ProgressBarStyle.Marquee;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900