Barcode Professional has a special method for obtaining barcode images, which can be used to represent the generation of barcode images using array bytes, so we can call this method to save the barcode image to a database or an XML file.
In the following example, we will create an ASP. NET Web application that can save the barcode image to an XML file through a DataSet object.
Steps:
Open it. NET development tools, such as visual Studio. NET, and create a new ASP.
Drag down the column control to the design interface:
Set Barcode Professional ' s symbology property 128 yards
Set Panel ' s Visible property to False
Double-click the button control and write the following code to the Button1_Click event program
VB
' Set the value to Encodebarcodeprofessional1.code = TextBox1.Text ' Create a DataSet and save the barcode Imagedim DS as Dat ASet = new DataSet ("myDataSet") Dim dt as DataTable = new DataTable ("MyTable") ds. Tables.add (DT) ' Create a ' column to hold the barcode Imagedim dc as DataColumn = New DataColumn ("Barcodeimage", GetType (Byte ())) dt. Columns.Add (DC) ' Create a new Rowdim dr as DataRow = dt. NewRow () ' Save the barcode imagedr ("barcodeimage") = Barcodeprofessional1.getbarcodeimage ( System.Drawing.Imaging.ImageFormat.Gif) dt. Rows.Add (DR) ' Show the DataSet contentliteral1.text = Server.HTMLEncode (ds. GETXML ()) panel1.visible = True
C #
Set the value to Encodebarcodeprofessional1.code = Textbox1.text;//create a DataSet and save the barcode Imagedataset DS = new DataSet ("myDataSet");D atatable dt = new DataTable ("MyTable");d S. Tables.add (DT);//create a column to hold the barcode imagedatacolumn DC = new DataColumn ("Barcodeimage", typeof (Byte[]));d T.columns.add (DC);//create a new Rowdatarow dr = dt. NewRow ();//save the barcode imagedr["barcodeimage"] = Barcodeprofessional1.getbarcodeimage ( System.Drawing.Imaging.ImageFormat.Gif);d T. Rows.Add (DR);//show the DataSet contentliteral1.text = Server.HTMLEncode (ds. GETXML ()); Panel1.visible = true;
Run the created ASP. NET Web application, and you'll see the output
650) this.width=650; "alt=" Barcode "class=" Img-thumbnail "src=" http://image.evget.com/images/article/2015/ Result1small.jpg "/>
650) this.width=650; "alt=" Barcode "class=" Img-thumbnail "src=" http://image.evget.com/images/article/2015/ Result2small.jpg "/>
This article is from the "294936239" blog, please be sure to keep this source http://294936239.blog.51cto.com/10806039/1709584
Barcode Professional for ASP. NET USE Tutorial: Barcode image saved to database or XML file