
Originariamente inviata da
Sonnyx74
Niente da fare ragazzi........... perdonatemi ma non sono assolutamente riuscito a farlo funzionare correttamente, in base alla parte di programma che ho scritto riuscite a darmi qualche indicazione pratica?
Ne ho veramente provate di tutte, ho cercato in largo e in lungo ma niente, funziona ma funziona a mezzo di sicuro manca quel poco per farlo funzionare, adesso vedo il risultato in euro ma solo se ci clicco sopra con un tasto, le operazioni funzionano correttamente, ma non riesco a vedere il calcolo in diretta e a formattare le celle con valore in euro, vi posto nuovamente i codici delle texbox, ho messo solo la somma e una delle due textbox l'altra è formattata uguale:
Private Sub TextBox32_Textchanged(sender As Object, e As EventArgs) Handles TextBox32.TextChanged, TextBox32.Leave
Dim differenza As String
differenza = CDbl(TextBox2.Text) - CDbl(TextBox4.Text)
TextBox32.Text = String.Format(CDec(differenza).ToString("c2"))
End Sub
Private Sub TextBox2_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox2.KeyPress
Dim KeyAscii As Short = Asc(e.KeyChar)
If KeyAscii < 48 And KeyAscii <> 24 And KeyAscii <> 8 And e.KeyChar <> "," And e.KeyChar <> "." Then
KeyAscii = 0
ElseIf KeyAscii > 57 Then
KeyAscii = 0
End If
If e.KeyChar = "." Then
KeyAscii = 44
End If
If TextBox2.TextLength = 0 And KeyAscii = 44 Then
KeyAscii = 0
End If
If (KeyAscii = 44) And TextBox2.Text.IndexOf(",") > 0 Then
KeyAscii = 0
End If
e.KeyChar = Chr(KeyAscii)
TextBox2.Text = String.Format(CDec(reitanlo).ToString("C2"))
End Sub
Vi prego aiutatemi !!!
Ma almeno hai provato a fare come ti abbiamo detto?
a me non sembra proprio...
Comunque to.. di solito non si fornisce la pappa pronta nei forum. Non è "educativo"...
codice:
Private Sub TxMinuendo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txSottraendo.KeyPress, TxMinuendo.KeyPress
If IsNumeric(e.KeyChar) Then Exit Sub
If Char.IsControl(e.KeyChar) Then Exit Sub
If e.KeyChar = "," And TryCast(sender, TextBox).Text.Contains(",") = False Then Exit Sub
e.Handled = True
End Sub
Private Sub TxMinuendo_TextChanged(sender As Object, e As EventArgs) Handles txSottraendo.TextChanged, TxMinuendo.TextChanged
If TxMinuendo.Text.Length = 0 Or txSottraendo.Text.Length = 0 Then Exit Sub
txDifferenza.Text = (CDec(TxMinuendo.Text) - CDec(txSottraendo.Text)).ToString("c2")
End Sub