473,508 Members | 2,074 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

9 digits no matter what

I've got an application where I enter ordernumbers through a barcodereader.
I would like to have the application save 9 digits to the accessdatabase no
matter how few digits is entered.
For instance if I enter: 12345678 I would like to "pad" a 0 on the lefthand
side making sure 9 digits is saved.

Is it possible and do I need to do something with the accessdatabase? (The
field I use in the database is of "number"-type)'

Regards
/Drygast
Nov 20 '05 #1
6 1460
Hi,

You are going to have to save the padded number as a string in the
access database if you want the zeros.

Dim x As Integer = 25

Me.Text = x.ToString("00000000#")

Ken

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

"Drygast" <dr*****@hotmail.com> wrote in message
news:On**************@TK2MSFTNGP10.phx.gbl...
I've got an application where I enter ordernumbers through a barcodereader. I would like to have the application save 9 digits to the accessdatabase no matter how few digits is entered.
For instance if I enter: 12345678 I would like to "pad" a 0 on the lefthand side making sure 9 digits is saved.

Is it possible and do I need to do something with the accessdatabase? (The
field I use in the database is of "number"-type)'

Regards
/Drygast

Nov 20 '05 #2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim MyStr As String

MyStr = Microsoft.VisualBasic.Format(334, "000000000")

MessageBox.Show(MyStr)

End Sub

Cheers - OHM

Drygast wrote:
I've got an application where I enter ordernumbers through a
barcodereader. I would like to have the application save 9 digits to
the accessdatabase no matter how few digits is entered.
For instance if I enter: 12345678 I would like to "pad" a 0 on the
lefthand side making sure 9 digits is saved.

Is it possible and do I need to do something with the accessdatabase?
(The field I use in the database is of "number"-type)'

Regards
/Drygast

Nov 20 '05 #3
"Drygast" <dr*****@hotmail.com> schrieb
I've got an application where I enter ordernumbers through a
barcodereader. I would like to have the application save 9 digits to
the accessdatabase no matter how few digits is entered.
For instance if I enter: 12345678 I would like to "pad" a 0 on the
lefthand side making sure 9 digits is saved.

Is it possible and do I need to do something with the accessdatabase?
(The field I use in the database is of "number"-type)'


If you need to keep leading zeros, the database field must be defined as
text. To add missing leading zeros, you can use
MsgBox(12345.ToString("000000000"))
--
Armin
Nov 20 '05 #4
Hi Drygast.

iSomeNumber.ToString.PadLeft (9)

Regards,
Fergus
Nov 20 '05 #5
Drygast,
If the number entered are in integer variables, you can use:

Dim x As Integer = 25

Me.Text = x.ToString("D9")

In addition to:

Me.Text = x.ToString("00000000#")

and the other formats discussed.

Hope this helps
Jay

"Drygast" <dr*****@hotmail.com> wrote in message
news:On**************@TK2MSFTNGP10.phx.gbl...
I've got an application where I enter ordernumbers through a barcodereader. I would like to have the application save 9 digits to the accessdatabase no matter how few digits is entered.
For instance if I enter: 12345678 I would like to "pad" a 0 on the lefthand side making sure 9 digits is saved.

Is it possible and do I need to do something with the accessdatabase? (The
field I use in the database is of "number"-type)'

Regards
/Drygast

Nov 20 '05 #6
Thanks guys, with your help everything now works as I wanted it to!!!!

/Regards
Drygast

"Armin Zingler" <az*******@freenet.de> wrote in message
news:eE**************@TK2MSFTNGP11.phx.gbl...
"Drygast" <dr*****@hotmail.com> schrieb
I've got an application where I enter ordernumbers through a
barcodereader. I would like to have the application save 9 digits to
the accessdatabase no matter how few digits is entered.
For instance if I enter: 12345678 I would like to "pad" a 0 on the
lefthand side making sure 9 digits is saved.

Is it possible and do I need to do something with the accessdatabase?
(The field I use in the database is of "number"-type)'


If you need to keep leading zeros, the database field must be defined as
text. To add missing leading zeros, you can use
MsgBox(12345.ToString("000000000"))
--
Armin

Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
7159
by: Westcoast Sheri | last post by:
What is the most efficient way of extracting the first two digits in a string? The following is wrong for me, because it only gives me the first instance of two digits together: $string =...
6
12561
by: Cyrus D. | last post by:
Hi guys, I want to validate a string to make sure it contains only digits. 0001 = true 6669 = true 00a0 = false 6.665 = false What's the best way to go about doing that ?
29
4310
by: mrstephengross | last post by:
Hi all... How can I find out the number of significant digits (to the right of the decimal place, that is) in a double? At least, I *think* that's what I'm asking for. For instance: 0.103 --> 3...
3
5810
by: Bei | last post by:
I have variable, say "total". It can be an integer or floating number. No matter what value it stores (5 or 5.1 or 5.24), when I display it, is there a way I can make it display it with fixed 2...
13
7077
by: CHRISTOF WARLICH | last post by:
Hi, does anyone know of an efficient way to find the number of digits (i.e. the most significant position that is 1) of a binary number? What I found so far is: - digits = (int) log2(number),...
27
31342
by: Luke Wu | last post by:
Is there a C function that returns the number of digits in an input int/long? example: numdigits(123) returns 3 numdigits(1232132) returns 7
4
12706
by: Anoop | last post by:
Hi All I am getting two different outputs when i do an operation using string.digits and test.isdigit(). Is there any difference between the two. I have given the sample program and the output ...
109
7517
by: jmcgill | last post by:
Hello. Is there a method for computing the number of digits, in a given numeric base, of N factorial, without actually computing the factorial? For example, 8! has 5 digits in base 10; 10! has...
4
4206
by: =?Utf-8?B?Vmlua2k=?= | last post by:
Hello Everyone, I am trying to convert the digits to even number so for example if I have 3 digit number, I want it to be 4 digit and If I have 5 digit number, I want it to be 6 digit. How can i...
0
7225
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7124
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7385
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1558
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.