I need to display 45.556 as 45.55 what is the format i need to use in true dbgrid pro 7.0.
Best Answer
Sorry not familiar with dbgird pro 7.0. If you are looking not looking to trucate the 6 as you showed in your example (rounded 45.556 is 45.56) you can use the format command, which will format your number to two decimal places, rounding accordingly.
format(*value*, "0.00")
Using "0.00" formats the number to default to zero in the position the zero is in.
Using "#.##" formats the number to default to space (nothing)
If you don't want to round the number and are only looking to get the number plus the right two decimal places.
Left(cStr(value), instr(cStr(value), ".") + 2))
Retrieves from the left your number plus 2 past the decimal, truncating the rest. You may not need to cStr(), as VB may explicitly convert it first.
using cStr() may create a space before the number which is from a minus sign would go, format() doesn't do this, if you see this issue in your grid.
VB6 is not a really good environment for multi-threaded applications. There is no out-of-the-box support, you need to delve into standard WinAPI functions. Take a look at this article, which provides quite a comprehensive sample:
For nearly all programming purposes, VBA and VB 6.0 are the same thing.
VBA cannot compile your program into an executable binary. You'll always need the host (a Word file and MS Word, for example) to contain and execute your project. You'll also not be able to create COM DLLs with VBA.
Apart from that, there is a difference in the IDE - the VB 6.0 IDE is more powerful in comparison. On the other hand, you have tight integration of the host application in VBA. Application-global objects (like "ActiveDocument") and events are available without declaration, so application-specific programming is straight-forward.
Still, nothing keeps you from firing up Word, loading the VBA IDE and solving a problem that has no relation to Word whatsoever. I'm not sure if there is anything that VB 6.0 can do (technically), and VBA cannot. I'm looking for a comparison sheet on the MSDN though.
Best Answer
Sorry not familiar with dbgird pro 7.0. If you are looking not looking to trucate the 6 as you showed in your example (rounded 45.556 is 45.56) you can use the format command, which will format your number to two decimal places, rounding accordingly.
Using "0.00" formats the number to default to zero in the position the zero is in.
Using "#.##" formats the number to default to space (nothing)
If you don't want to round the number and are only looking to get the number plus the right two decimal places.
Retrieves from the left your number plus 2 past the decimal, truncating the rest. You may not need to cStr(), as VB may explicitly convert it first.
using cStr() may create a space before the number which is from a minus sign would go, format() doesn't do this, if you see this issue in your grid.