Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Rechnen mit Double im Grid ?

Empfohlene Antworten

Veröffentlicht

Hallo !

Ich habe folgendes Problem, ich möchte mit meinem Grid eine Summe berechnen, in der letzten Spalte.

Ich habe zum Teil nur Double (cdbl) Werte, rechne ich nun mit einer normalen Formel den wert aus, werden die Zahlen nach dem Komma nicht Berücksichtigt.

For z = 1 To MSHFlexGrid1.Text

For y = 1 To 5

MSHFlexGrid1.Row = y

For x = 2 To 11

MSHFlexGrid1.Col = x

---------------------------------------------------------

'If IsNumeric(MSHFlexGrid1.Text) Then ????

' .Val = CDbl(MSHFlexGrid1.Text) ????

' End If

-----------------------------------------------------------

wert = Val(MSHFlexGrid1.Text) +++Übergabe des Wertes+++

+++Hier habe ich es mit Format versucht+++

MSHFlexGrid1.Text = Format(MSHFlexGrid1.Text, "##,#0.00")

wert = Format(wert, "##.#0.00")

wert = Val(MSHFlexGrid1.Text)

wert1 = CDbl(wert1) + CDbl(wert)

MSHFlexGrid1.Col = 12

MSHFlexGrid1.Text = wert1

Next x

wert1 = 0

Next y

Next z

End Sub

Hmm, bin mir nicht ganz sicher, wir arbeiten nicht mit dem MSFlexGrid sondern mit Farpoint aber kann man nicht den einzelnen Zellen wie in Excel Formate zuweisen???

Ich mein jetzt nicht mit Format-Befehl, der formatiert ja nur Strings, sondern halt den Feldern direkt sagen du bist jetzt ein Double feld mit soundsovielen Nachkommastellen...

Bei Farpoint geht das auf jeden Fall so, guck doch mal ob du in der Richtung was findest

Hi!

Dein Problem ist vermutlich die Zeile mit dem VAL(FlexGrid.text).

VAL kommt mit nem Komma als Dezi-Trenner nicht klar.

Mach ma:

wert = VAL( Replace(FlexGrid.Text, ",", ".") )

...und auf diese Zeile 'n Haltepunkt. Dann kannze beim durchsteppen direkt ansehen, was VAL da so alles zurückgibt.

Bescheuerterweise verhält sich das bei CDbl wieder anders.

CDbl ignoriert z.B. den Punkt in einem String:

123.45 wird zu 12345 und 123,45 wird korrekt umgewandelt.

HTH,

JazzByte.

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.