| In this sample, we will create a sample device application project to generate a barcode and save the barcode image in a folder of the mobile device. |
Open Microsoft Visual Studio 2005 and create a new device application project.

Add a reference to the Aspose.BarCode.Compact.dll as described here.
Add the controls on the form as shown in the figure below:

The button with “…” caption will be used to browse the path of the barcode image. Write the following code on its button click event.
Programming Sample
[C#]
SaveFileDialog fd = new SaveFileDialog();
if (fd.ShowDialog() == DialogResult.OK)
{
txtBarCodeImage.Text = fd.FileName;
}
[VB.NET]
Dim fd As SaveFileDialog = New SaveFileDialog()
If fd.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
txtBarCodeImage.Text = fd.FileName
End If
Write the code below on the click event of “Generate BarCode Image” button.
[C#]
// create an instance of BarCodeBuilder
BarCodeBuilder builder = new BarCodeBuilder();
// set the symbology type
builder.SymbologyType = Symbology.Code39Standard;
// set the codetext
builder.CodeText = "test-123";
// get the barcode image
Image img = builder.BarCodeImage;
// save the image at the specified location
img.Save(txtBarCodeImage.Text, System.Drawing.Imaging.ImageFormat.Bmp);
[VB.NET]
' create an instance of BarCodeBuilder
Dim builder As BarCodeBuilder = New BarCodeBuilder()
' set the symbology type
builder.SymbologyType = Symbology.Code39Standard
' set the codetext
builder.CodeText = "test-123"
' get the barcode image
Dim img As Image = builder.BarCodeImage
' save the image at the specified location
img.Save(txtBarCodeImage.Text, System.Drawing.Imaging.ImageFormat.Bmp)
Run the application and select Pocket PC 2003 SE Emulator and click on Deploy. Your application will be deployed on Pocket PC 2003 Emulator. Click on “…” button to browse the path for saving the barcode image. Enter the values as shown in the screen below:

After you press OK, path of the image will be saved to the textbox. Now, click on Generate BarCode Image button to generate the barcode image.
To see the generated image, click on Start (Windows) icon on the Pocket PC emulator and select Programs. Select File Explorer and open the folder where you saved the barcode image. You should be able to see the barcode image that you just created. Double click on the image to view the file. Following is the screenshot of the image that was generated using the above code.
SaveFileDialog fd = new SaveFileDialog(); if (fd.ShowDialog() == DialogResult.OK) { txtBarCodeImage.Text = fd.FileName; }
Dim fd As SaveFileDialog = New SaveFileDialog()
If fd.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
txtBarCodeImage.Text = fd.FileName
End If
Write the code below on the click event of “Generate BarCode Image” button.
// create an instance of BarCodeBuilder BarCodeBuilder builder = new BarCodeBuilder(); // set the symbology type builder.SymbologyType = Symbology.Code39Standard; // set the codetext builder.CodeText = "test-123"; // get the barcode image Image img = builder.BarCodeImage; // save the image at the specified location img.Save(txtBarCodeImage.Text, System.Drawing.Imaging.ImageFormat.Bmp);
' create an instance of BarCodeBuilder Dim builder As BarCodeBuilder = New BarCodeBuilder() ' set the symbology type builder.SymbologyType = Symbology.Code39Standard ' set the codetext builder.CodeText = "test-123" ' get the barcode image Dim img As Image = builder.BarCodeImage ' save the image at the specified location img.Save(txtBarCodeImage.Text, System.Drawing.Imaging.ImageFormat.Bmp)
Run the application and select Pocket PC 2003 SE Emulator and click on Deploy. Your application will be deployed on Pocket PC 2003 Emulator. Click on “…” button to browse the path for saving the barcode image. Enter the values as shown in the screen below:

After you press OK, path of the image will be saved to the textbox. Now, click on Generate BarCode Image button to generate the barcode image.
To see the generated image, click on Start (Windows) icon on the Pocket PC emulator and select Programs. Select File Explorer and open the folder where you saved the barcode image. You should be able to see the barcode image that you just created. Double click on the image to view the file. Following is the screenshot of the image that was generated using the above code.
