I am new in this field and I find myself in difficulty, I have already looked for two days on the internet and I have not found anything or at least that is understandable within my reach. I downloaded a file for a new ProgressBar in 3d, but I no longer have the option of [Step] and [PerformStep], how can I add these two properties? Please help me, I've been running after it for days....
I downloaded a file from this post https://social.msdn.microsoft.com/Forums/vstudio/en-US/5d3eee65-730b-488f-a858-a341b8d61714/progressbar-with-percentage-label?forum=vbgeneral at the bottom of the page the link for RmCustProgressBar but I have problems. Here The file for download is file txt https://onedrive.live.com/?authkey=!ADU6srhRub2eM6M&cid=00D11ED12923BE81&id=D11ED12923BE81!114&parId=root&o=OneUp
Public Sub righeNere()
Dim row_count As Integer = DataGridView1.Rows.Count
RmCustProgressBar1.MaxValue = row_count
RmCustProgressBar1.Step = 1
Dim currencyManager1 As CurrencyManager = CType(DataGridView1.BindingContext(DataGridView1.DataSource), CurrencyManager)
For Each rw As DataGridViewRow In DataGridView1.Rows
If rw.Cells(2).Style.BackColor = Color.Gold Or rw.Cells(3).Style.BackColor = Color.Gold Or rw.Cells(4).Style.BackColor = Color.Gold Or rw.Cells(5).Style.BackColor = Color.Gold Or rw.Cells(6).Style.BackColor = Color.Gold Or rw.Cells(7).Style.BackColor = Color.Gold Then
rw.Visible = True
Continue For
ElseIf rw.Cells(2).Style.BackColor = Color.White Or rw.Cells(3).Style.BackColor = Color.White Or rw.Cells(4).Style.BackColor = Color.White Or rw.Cells(5).Style.BackColor = Color.White Or rw.Cells(6).Style.BackColor = Color.White Or rw.Cells(7).Style.BackColor = Color.White Then
currencyManager1.SuspendBinding()
rw.Visible = False
currencyManager1.ResumeBinding()
RmCustProgressBar1.PerformStep()
End If
Next
End Subd
CodePudding user response:
I assume that Step
is a step size and that PerformStep
simply adds this step to the Value
property. Then you can add this functionality like this in the progress bar class:
Public Property [Step] As Integer
Public Sub PerformStep()
Value = Math.Min(MaxValue, Value [Step])
'To refresh the progress bar immediately (optional)
Refresh()
End Sub
Setting the Value
property invalidates the control, i.e. the new progress bar position will be displayed automatically, but maybe with some delay. If you want to refresh it immediately, you can force a redraw by calling Refresh()
. See: Control.Refresh Method
Note that Step
is a reserved word in VB, therefore we must put it in angle brackets. Instead, we could also call it StepSize
.