Sorry but my control is meant to be used with numbers and that's not a number. You can use a MaskedEdit control for IPs.
Printable View
Sorry but my control is meant to be used with numbers and that's not a number. You can use a MaskedEdit control for IPs.
I noticed a bug. When I have my Max value set to 5000.99 and I type in 8888888 in the box. The number changes to 500099, without the decimal. Which is a much higher number than the max in the first place.. I don't know how to fix this myself and I cannot even compile your source code..
It doesn't do that for me. I did notice for the first time however that if I set the MaxValue to 5000.99 that the MinValue also gets set to 5000.99. What is your MinValue? And what do you mean when you say you can't compile my code?
Ok, I have it set to use a comma not a period. So in the Max value you would have to let the user put ###,## instead of erasing the , when entered in max value. Or change it to whatever decimal the user picks.
It works when I use a . for the decimal but not ,
And I get an error somewhere in the source code..
If you don't get what I say... Whenever a . is entered in the box and I only allow commas, it will delete the period so I end up with 500099
Okay, the comma/period code is new so there may well be a problem. I'll look into it but it won't be until tomorrow.Quote:
Originally Posted by bluehairman
Updated to Version 1.12 which corrects the problem with MaxValue and MinValue when the decimal seperator is a comma.
Hm.. I received your email but the updated version still seems to have that bug.
I get an error while trying to compile saying User Defined type not Defined.
It highlights this line:
Dim m_DataSource As StdDataFormat
I tried to fix the bug with this but I cannot test it..
Quote:
Private Sub txtNumberBox_KeyUp(KeyCode As Integer, Shift As Integer)
......
On Error Resume Next
If CDbl(txtNumberBox.Text) > MaxValue Then
txtNumberBox.Text = MaxValue
If DecimalSeperator = Comma Then
txtNumberBox.Text = Replace(MaxValue, ".", ",")
End If
End If
If CDbl(txtNumberBox.Text) < MinValue Then
txtNumberBox.Text = MinValue
If DecimalSeperator = Comma Then
txtNumberBox.Text = Replace(MinValue, ".", ",")
End If
End If
'******* 1.12 End *********
'******* 1.9 End *********
End Sub
When you say "updated version" are you talking about the one I sent you or v1.12 that I posted here on the 25th? If you mean the former than you should try the v1.12.
Martin,
Do you know of a reason why v1.11 and v1.12 would be doing this when I try to compile?
When I try to make an executable I get an error (see attached) and all the number boxes have a diagonal hatch.
The program runs inside the IDE fine though.
Have you seen this before?
The recent changes I made had to do with the difference in the way Europeans format numbers versus the way we in the US do. I'm sure that the problem involves either the System Locale or the Code Locale. Here's what MS has to say about it.
______________________________________________________________________
System Locale vs. Code Locale
The system locale is the locale of the user who runs your program — it is used as a reference for user input and output and uses Control Panel settings provided by the operating system. The code locale is always English/U.S. in Visual Basic, regardless of which international version you use. Code locale determines the programming language and all the locale-specific settings.
______________________________________________________________________
The change that I made was to change a Val() text-to-number conversion to a Cdbl() because from what I read Val() always assumes that the period is the decimal separator while CDbl use the system locale to determine the decimal separator.
To test the program I went to the control panel (Regional and Language Options|Regional Options) and changed my system locale from English (United States) to English (United Kingdom) and it worked fine. So assuming that your system locale is English (United Kingdom) I don't understand what's going on but I'll take another look at the program.
No, I am in the united states..
I would just rather the comma than the period but if it is too much trouble (or isn't what you'd like) I can deal with it just being a period.
Also do you know how to fix my error?
I'm really confused about your post #67. What does StdDataFormat have to do with my program. Also at this point I believe my program is working properly. If it's not please tell me what it is doing that is wrong.
Updated to Version 1.13.
Please see post #1 for changes and the decription of a known problem. Suggestions for fixing that problem are more than welcome.
Updated to Version 1.14.
Here's a bug but not sure how easily it could be fixed.
If a decimal number is in the numberbox, when you highlight the contents to replace it's contents, you can't start off by pressing a decimal point (as there is already a decimal seperator in the cell).
Updated to Version 1.15. Corrects problem reported in post #75.
I made a small change to 1.15 so if anyone downloaded it then please download it again.
Updated to Version 1.16
I have just installed my app on a computer with Vista. I get an error saying Component ‘numberbox.ocx’ or one of its dependencies not correctly registered: a file is missing or invalid.
Are there any dependancy files that the numberbox.ocx has that may not be on vista computers?
I found this re Cryst32.ocx. I wonder if it's a similar situation or if I'm just failing something in the installation.
Quote:
The most common reason the Cryst32.ocx will not register is that it is missing one or more dependencies.
To register the crystl32.ocx make sure the following dependencies are present on your machine, then the OCX will register.
crystl32.ocx Dependencies
ADVAPI32.DLL
COMCTL32.DLL
COMDLG32.DLL
CRPE32.DLL
GDI32.DLL
IMPLODE.DLL
MFC42.DLL
MSVCRT.DLL
MSVCRT20.DLL
OLE32.DLL
OLEAUT32.DLL
OLEDLG.DLL
OLEPRO32.DLL
USER32.DLL
VERSION.DLL
Please note: while all of these files need to be present in order to successfully register the OCX, some files are system files and should not be distributed.
Another item to check is that the version number of each dll on the client matches what is on your development machine (or at least matches what is on another client machine where the app does work).
I recommend using EXTREME CAUTION when moving dlls between a machine with one OS to another with a different one. Regardless of the machines' OS, if you choose to copy dlls, please make sure to back up the old ones in case something goes awry.
Please note that although the crystl32.ocx file can reside anywhere on your machine (as it is a registered file), its dependencies must reside in the system path.Finally, I would suggest downloading the Dependendency Walker utility from the following link to help troubleshoot your issue:
http://community.seagatesoftware.com...es/depends.zip
You can point this utility to Crystl32.ocx on the client machine to determine which of its dependencies the OCX is having issues with.
Working files show up in green or cyan, while non-working files show up in yellow, orange, or red.
I am sure that you will find this utility extremely helpful.
To manually register the OCX after you have ensured that all the dependencies are present, you will need to select :
Start | Run and type in something like this:
regsvr32.exe "C:\Windows\System\crystl32.ocx"
Hope this helps.
E. McEvoy
Crystal Reports Consultant
I'm sorry but I have no experience with Vista. Perhaps you should create a new thread in the Visual Basic 6 and Earlier forum.
Sorry. My mistake. I had the incorrect .ocx version registered on the vista computer.
Found a bug. Run the Test project (all defaults), type 222.333 then go to the decimal point and delete it (backspace or delete), the text changes to 450.5
I'm not sure what test project you mean, and by default the maximum decimals are set to 2, so you can't type 222.333, but even if I set MaxDecimals to 3 and I do as you say I get 222333.
I just downloaded the project from the first post, ran it (NumberBox.vbg) without changin anything. I happens every time. It could be the max decimal thing, I didn't change anything there either.
Oh. I just now noticed it has max and min value properties. It was changing based on that. In the attached project they are set to -19 and 450.5. That's why it was chaning it. My appologies.
No problem.
This control is awesome and saves a lot of coding. It is great work. Thanks for it. Does it have a MaxLength property like for TextBox? How to allow commas to be typed in? E.g. 3,200.00 or 1,000,000.00, i.e. a comma separator for each three digits starting from the decimal point and going to the left, given that the decimal separator is a period.
Thanks.
The current version of the control does not allow adding commas as thousands separators so if you need them in a report or something my suggestion would be to use Format().
I'm not promising to make the change but if I were to allow the use of thousand separators would you you want to be able to type them in, or would you like the control to add them automatically?
An option to allow thousands separators, and then one to add them automatically or not (i.e. allow them to be typed).