We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

VB.NET Barcode Size

Since this library was made using C#, most of the code is in C#. I have found lots of code to size 2D barcodes, but they don’t translate well to VB.NET. How would one go about setting the barcode size in VB.NET?


In Aspose.BarCode Docs, we provide example codes in C#.NET, the users can translate to VB.NET by themselves. Could you please share sample runnable C# code which is not translated well that you want to translate to VB.NET? We will check and help you accordingly.


                    I tried the following code to no avail.

    ' I converted this to VB.NET, but it still did not work.
generator.Parameters.AutoSizeMode = False
    generator.Parameters.ImageHeight.Pixels = 300
    generator.Parameters.ImageWidth.Pixels = 300

    // I have seen these options on the internet, but they don't translate to VB.NET. 
   // I have also read that the options below don't affect the barcode just the border.
generator.BarCodeWidth = 200
generator.BarCodeHeight = 75

generator.X = 3
generator.Y = 3


Could you please share your complete VB.NET sample code (runnable), preferably a standalone sample VS.NET application to reproduce the issue. We will evaluate your issue and help you through.

PS. please zip the VS.NET application prior attaching here.


Sorry for the long delay in responding, but I figured it out.
I am posting the code below in case anyone else runs into this issue.
Thanks for the moral support and fast response times though.

'This doesn’t really do anything as I changed the lines from
200 to 100 and noticed nothing.
generator.Parameters.ImageWidth.Pixels = 100
generator.Parameters.ImageHeight.Pixels = 100

'The next line of code is what made it work.
generator.Parameters.Barcode.XDimension.Pixels = 1

'The next 4 lines of code just remove the white borders
generator.Parameters.Barcode.Padding.Left.Pixels = 1
generator.Parameters.Barcode.Padding.Right.Pixels = 1
generator.Parameters.Barcode.Padding.Bottom.Pixels = 1
generator.Parameters.Barcode.Padding.Top.Pixels = 1

'The code below just removes the caption.
generator.Parameters.Barcode.CodeTextParameters.Location = CodeLocation.None


It is nice to know that you have sorted it out now. In the event of further queries or issue, feel free to write us back.