• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 227
  • Last Modified:

Barcode code

Is there any code (not .vbx or .ocx) that can produce barcodes? If so, can you please tell me where I can obtain it?
0
rsolomon
Asked:
rsolomon
  • 4
  • 4
1 Solution
 
Jaysin28Commented:
We use a random number generator and then set the font to a font called 3of9.  Most barcodes programs use this scheme since there isn't a data type of Bar code.

Try doing this with your app.
0
 
rsolomonAuthor Commented:
Give me an example. I don't know what you are taking about, when you say use a random number generator.
0
 
Jaysin28Commented:
VB has a Random Number Generator.  Using Rnd the system will pick a random number.

i.e.

MyValue = Int((6 * Rnd) + 1)   ' Generate random value between 1 and 6.

Before making this call however to ensure that the same number isn't generated twice you also have to call:

Initializes the random-number generator.

Syntax

Randomize [number]

The optional numberargument is aVariant or any validnumeric expression.

Remarks

Randomize uses number to initialize the Rnd function's random-number generator, giving it a newseed value. If you omit number, the value returned by the system timer is used as the new seed value.

If Randomize is not used, the Rnd function (with no arguments) uses the same number as a seed the first time it is called, and thereafter uses the last generated number as a seed value.

Note   To repeat sequences of random numbers, call Rnd with a negative argument immediately before using Randomize with a numeric argument. Using Randomize with the same value for number does not repeat the previous sequence

0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
rsolomonAuthor Commented:
Ok I understand the RND function, how do you incorporate this into code?
0
 
Jaysin28Commented:
Public sub Form_Main()

Randomize
MyValue = Int((32000 * Rnd) + 1) 1 to 32000

myDatabase.fields("Barcode") = cStr(MyValue)

end sub

When viewing this value anywhere (label, textbox, etc.) set the font to 3 of 9..  This will show a barcode representation of the number.
0
 
rsolomonAuthor Commented:
Would you just set the font on the printer control,
like pctl.font = "3of9"?
0
 
Jaysin28Commented:
YEs, but this has to be a valid True Type font that exists in the Windows\Fonts directory, and the Printer you are using needs to be able to read true type fonts.  (most of them do).  If you need the font then send mail to Jaysin28@aol.com and provide your email address.  I will send it.
0
 
rsolomonAuthor Commented:
thanks

ronald.solomon@usa.net
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now