Hi,
I m displaying a ultraprogressbar in a Ultragrid cell.My problem is that the progress bar depends on data from other column of grid.The maximum property of ultraprogress bar should be assigned a value through loop.i.e. i wish to assign different value to maximum when looping through each row of grid.
My code is
For Each row In UltraGrid1.Rows
UltraProgressBar1.Maximum = row.Cells("Planned Hours").Value
Next
But here the maximum takes the last value in the loop.But I need to assign a different value at each iteration of the loop.Is it possible???????
Please Help me...................
You need to create a different progress bar for each cell.
Change this:
To:
UltraProgressBar bar = new UltraProgressBar()
bar.Maximum = row.Cells("Planned Hours").Value
row.Cells("Percentage").EditorControl = bar
Two more tips:
1. Don't enumerate rows. Use InitializeRow event and get the row from e.Row. Thsi event occurs also when a cell value is changed.
2. Set the progress bar text to "[Value] / [Maximum]"
Thank u Amiram Thanx a lot...................
The code u gave worked well..................Thanx again.
The code u gave worked fine...................
But now I wish to change the color of progressbar according to the percentage.........I also used PercentageSettings property for this purpose but it is not reflecting any changes.I m still getting the blue progressbar.
I wrote
If (row.Cells("Planned Hours").Value > row.Cells("Remained Hours").Value) Then
End If
bar.PercentSettings.Add(25).FillAppearance.BackColor = Color.Red
bar.PercentSettings.Add(50).FillAppearance.BackColor = Color.Blue
bar.PercentSettings.Add(75).FillAppearance.BackColor = Color.Yellow
bar.PercentSettings.Add(100).FillAppearance.BackColor = Color.Green
But no changes can be seen .....................
pls help...........Thanx in advance.......
Also is it possible that the column in which we are displaying ultraprogressbar if that column has some text data then we can also see that text at run time behind the progressbar?
Try setting the UseOSThemes property of the progress bar to false.
As for the question about showing text in addition to the progress bar, no, I don't think this is possible, since the EditorControl is resonsible for rendering the cell's contents, and the UltraProgressBar doesn't support the string datatype. In fact, if you set this as the EditorControl of a string column, your application may be running slower because there would be a lot of FormatExceptions thrown in the code when the progress bar tries to convert the strings to numeric types.
-Matt
Thanx a lot Matt for ur reply.............
Yes I had already set UseOsThemes property to false.
Yes I also think that it is not possible to show text along with progressbar.Bcoz I researched a lot for this but no results.............But still if someone thinks that it is possible then let me know.
Thnx again Matt.