Click here to Skip to main content
16,003,746 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionprogress bar, percent complete Pin
jkirkerx28-Jul-15 10:16
professionaljkirkerx28-Jul-15 10:16 
My formula or code is terrible for calculating the percentage complete based on 100
There must be a better way to write this.
Just looking for suggestions, in this example, there are 330 records, and the step is .0627
So the first value is -1, and the program bombs. Now my m_progressPos is always 0.

I mostly write web apps, so I don't have much experience with this.

This is what I have.
If (itemIndex.Count > 0) Then
  dialogPos = 0.0
  dialogStep = 100 / itemIndex.Count - 1
  dialogWait.UpdateProgress(1, "Located " & itemIndex.Count & " product items(s)")
End If

rC = 0
For Each i As itemIndex In itemIndex

  dialogPos += dialogStep
  Dim m_dialogPos As Integer = Convert.ToInt32(Math.Round(dialogPos))
  m_dialogPos = If(m_dialogPos > -1, m_dialogPos, 0)
  dialogWait.UpdateProgress(m_dialogPos, "Calculating profit for " & i.ItemNumber & "  (" & rC & " of " & itemIndex.Count & ")  ")

  load_SR_Invoice_Profit(connection, i.ItemNumber, profits)
  rC += 1

Next
<pre>

AnswerRe: progress bar, percent complete Pin
Eddy Vluggen28-Jul-15 11:42
professionalEddy Vluggen28-Jul-15 11:42 
AnswerRe: progress bar, percent complete Pin
Ross Pickard28-Jul-15 12:04
Ross Pickard28-Jul-15 12:04 
AnswerRe: progress bar, percent complete Pin
jkirkerx30-Jul-15 13:27
professionaljkirkerx30-Jul-15 13:27 
QuestionListOf, check for existing value first Pin
jkirkerx28-Jul-15 9:31
professionaljkirkerx28-Jul-15 9:31 
Answer[solved] Pin
jkirkerx28-Jul-15 10:47
professionaljkirkerx28-Jul-15 10:47 
QuestionIs there any library to compare 2 sql server databases ? Pin
satc27-Jul-15 0:49
satc27-Jul-15 0:49 
AnswerRe: Is there any library to compare 2 sql server databases ? Pin
Wendelius27-Jul-15 0:58
mentorWendelius27-Jul-15 0:58 
GeneralRe: Is there any library to compare 2 sql server databases ? Pin
satc27-Jul-15 1:09
satc27-Jul-15 1:09 
GeneralRe: Is there any library to compare 2 sql server databases ? Pin
Wendelius27-Jul-15 1:47
mentorWendelius27-Jul-15 1:47 
AnswerRe: Is there any library to compare 2 sql server databases ? Pin
Chris Quinn27-Jul-15 2:12
Chris Quinn27-Jul-15 2:12 
GeneralRe: Is there any library to compare 2 sql server databases ? Pin
satc27-Jul-15 2:43
satc27-Jul-15 2:43 
GeneralRe: Is there any library to compare 2 sql server databases ? Pin
Chris Quinn27-Jul-15 3:59
Chris Quinn27-Jul-15 3:59 
GeneralRe: Is there any library to compare 2 sql server databases ? Pin
satc27-Jul-15 4:07
satc27-Jul-15 4:07 
GeneralRe: Is there any library to compare 2 sql server databases ? Pin
Sascha Lefèvre27-Jul-15 4:31
professionalSascha Lefèvre27-Jul-15 4:31 
GeneralRe: Is there any library to compare 2 sql server databases ? Pin
satc27-Jul-15 19:48
satc27-Jul-15 19:48 
QuestionCrazy ODBCDataReader Pin
Marcus Genovese24-Jul-15 4:12
Marcus Genovese24-Jul-15 4:12 
AnswerRe: Crazy ODBCDataReader Pin
Richard Deeming24-Jul-15 4:49
mveRichard Deeming24-Jul-15 4:49 
GeneralRe: Crazy ODBCDataReader Pin
Marcus Genovese24-Jul-15 5:25
Marcus Genovese24-Jul-15 5:25 
QuestionHow to write Worksheet Change Event in Visual Studio 2010??? Pin
Member 1184098123-Jul-15 21:27
Member 1184098123-Jul-15 21:27 
QuestionOracleDataReader GetChars method only buffering half the characters Pin
Aaron Rosenthal22-Jul-15 12:48
Aaron Rosenthal22-Jul-15 12:48 
AnswerRe: OracleDataReader GetChars method only buffering half the characters Pin
Eddy Vluggen22-Jul-15 23:33
professionalEddy Vluggen22-Jul-15 23:33 
GeneralRe: OracleDataReader GetChars method only buffering half the characters Pin
Aaron Rosenthal23-Jul-15 2:03
Aaron Rosenthal23-Jul-15 2:03 
GeneralRe: OracleDataReader GetChars method only buffering half the characters Pin
Eddy Vluggen23-Jul-15 2:13
professionalEddy Vluggen23-Jul-15 2:13 
AnswerRe: OracleDataReader GetChars method only buffering half the characters Pin
Richard Deeming23-Jul-15 2:20
mveRichard Deeming23-Jul-15 2:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.