Tema: progress bar
Ver Mensaje Individual
  #3 (permalink)  
Antiguo 14/08/2011, 19:14
guillebomtrasmiti
 
Fecha de Ingreso: noviembre-2010
Ubicación: madrid
Mensajes: 478
Antigüedad: 13 años, 5 meses
Puntos: 5
Respuesta: progress bar

Public Sub restarporcentaje()

Dim adapt As New OleDbDataAdapter
Dim setda As New DataSet
Dim com = conexion.CreateCommand
Dim total As Decimal = 0
Dim totalcelda As Decimal = 0
Dim totalfinal As Decimal = 0
Dim division As Decimal = 0
Dim a As Integer

For Each row As DataGridViewRow In DgTotales.Rows
'carga el textbox total con lo que exista en el grid
Dim s As String = CType(row.Cells(5).Value, String)

If row.Cells(0).Value Is Nothing Then
' MessageBox.Show("Estimación Finalizada", "Aviso GesDreamtpos")
ProgressBar1.Value = 0
Else
' Set the interval for the timer.
Timer1.Interval = 250
' Start the timer.
Timer1.Start()
' Increment the value of the ProgressBar a value of one each time.
ProgressBar1.Increment(1)
' Display the textual value of the ProgressBar in the StatusBar control's first panel.
Label14.Text = ProgressBar1.Value.ToString() + "% Completed"
' Determine if we have completed by comparing the value of the Value property to the Maximum value.
If ProgressBar1.Value = ProgressBar1.Maximum Then
' Stop the timer.
Timer1.Stop()
End If

''''''''''''''''''''''''''''''''''''''''''''''''''
If s = "TARJETA CREDITO" Then
'MessageBox.Show("es tarjeta")
Else
'total clda es el total que hay en la parrila linea a linea de cantidad por pts
totalcelda = CDec(Val(row.Cells(1).Value) * Val(row.Cells(2).Value))
'tota es el cálculo que hago para sacar el porcentaje que me pide el usuario
total = CDec((Val(row.Cells(1).Value) * Val(row.Cells(2).Value)) * CDbl(TxtPorcentaje.Text) / 100)
'total final es el porcentaje restado a la celda, para conseguir la cantidad deseada por el usuario
totalfinal = CDec(CStr(CDec(totalcelda - total)))
'división es el total entre la cantidad para sacar la cantidad que debe ir en la celda pts
division = CDec(totalfinal / Val(row.Cells(1).Value))
Textprueba.Text = CStr(division.ToString("#,##0.00€"))
'a lo utilizo para marcar en que celda estoy es la idcomanda
a = CInt((Val(row.Cells(11).Value)))
Textpruebafinal.Text = CStr(a)
' los textbox que utilizo aquí están ocultos tras el datagrid

com.CommandType = CommandType.Text
com.CommandText = "UPDATE IntroduccionDeVentasAhora SET Pts = ('" & Textprueba.Text & "') Where IdComanda = (" & a & ") and NombreFormaPago <> ('TARJETA CREDITO') and Fecha BETWEEN @FI AND @FF"

com.Parameters.AddWithValue("@FI", Fecha1.Value.Date.ToString("dd/MM/yyyy"))
com.Parameters.AddWithValue("@FF", Fecha2.Value.Date.ToString("dd/MM/yyyy"))

adapt.SelectCommand = com

conexion.Open()

com.ExecuteNonQuery()

conexion.Close()
End If
End If
Next
osea aquí que hago mal?¿?, veo que tu explicación se queda corta para mi entendedera...que es poca sorry