ByteScout Barcode Suite - VB.NET - Calculations and spreadsheet as database with spreadsheet sdk - ByteScout

ByteScout Barcode Suite – VB.NET – Calculations and spreadsheet as database with spreadsheet sdk

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Suite – VB.NET – Calculations and spreadsheet as database with spreadsheet sdk

calculations and spreadsheet as database with spreadsheet sdk in VB.NET using ByteScout Barcode Suite

Learn calculations and spreadsheet as database with spreadsheet sdk in VB.NET

Easy to understand coding instructions are written to assist you to try-out the features without the requirement to write your own code. ByteScout Barcode Suite was made to help with calculations and spreadsheet as database with spreadsheet sdk in VB.NET. ByteScout Barcode Suite is the bundle that privides 3 SDK products to generate barcodes (Barcode SDK), read barcodes (Barcode Reaer SDK) and read and write spreadsheets (Spreadsheet SDK).

Save time on writing and testing code by using the code below and use it in your application. If you want to know how it works, then this VB.NET sample code should be copied and pasted into your application’s code editor. Then just compile and run it. Enjoy writing a code with ready-to-use sample VB.NET codes to add calculations and spreadsheet as database with spreadsheet sdk functions using ByteScout Barcode Suite in VB.NET.

Trial version along with the source code samples for VB.NET can be downloaded from our website

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Form1.Designer.vb
      
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Class Form1 Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. <System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean) If disposing AndAlso components IsNot Nothing Then components.Dispose() End If MyBase.Dispose(disposing) End Sub 'Required by the Windows Form Designer Private components As System.ComponentModel.IContainer 'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor. <System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent() Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Form1)) Me.GroupBox1 = New System.Windows.Forms.GroupBox Me.Button4 = New System.Windows.Forms.Button Me.TextBox4 = New System.Windows.Forms.TextBox Me.Label3 = New System.Windows.Forms.Label Me.TextBox3 = New System.Windows.Forms.TextBox Me.Label4 = New System.Windows.Forms.Label Me.TextBox2 = New System.Windows.Forms.TextBox Me.Label2 = New System.Windows.Forms.Label Me.TextBox1 = New System.Windows.Forms.TextBox Me.Label1 = New System.Windows.Forms.Label Me.Button1 = New System.Windows.Forms.Button Me.Button2 = New System.Windows.Forms.Button Me.Button3 = New System.Windows.Forms.Button Me.Label5 = New System.Windows.Forms.Label Me.GroupBox1.SuspendLayout() Me.SuspendLayout() ' 'GroupBox1 ' Me.GroupBox1.Controls.Add(Me.Button4) Me.GroupBox1.Controls.Add(Me.TextBox4) Me.GroupBox1.Controls.Add(Me.Label3) Me.GroupBox1.Controls.Add(Me.TextBox3) Me.GroupBox1.Controls.Add(Me.Label4) Me.GroupBox1.Controls.Add(Me.TextBox2) Me.GroupBox1.Controls.Add(Me.Label2) Me.GroupBox1.Controls.Add(Me.TextBox1) Me.GroupBox1.Controls.Add(Me.Label1) Me.GroupBox1.Location = New System.Drawing.Point(12, 6) Me.GroupBox1.Name = "GroupBox1" Me.GroupBox1.Size = New System.Drawing.Size(166, 212) Me.GroupBox1.TabIndex = 0 Me.GroupBox1.TabStop = False ' 'Button4 ' Me.Button4.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(204, Byte)) Me.Button4.Location = New System.Drawing.Point(9, 175) Me.Button4.Name = "Button4" Me.Button4.Size = New System.Drawing.Size(135, 23) Me.Button4.TabIndex = 14 Me.Button4.Text = "Recalculate" Me.Button4.UseVisualStyleBackColor = True ' 'TextBox4 ' Me.TextBox4.Location = New System.Drawing.Point(9, 149) Me.TextBox4.Name = "TextBox4" Me.TextBox4.Size = New System.Drawing.Size(135, 20) Me.TextBox4.TabIndex = 13 ' 'Label3 ' Me.Label3.AutoSize = True Me.Label3.Location = New System.Drawing.Point(6, 94) Me.Label3.Name = "Label3" Me.Label3.Size = New System.Drawing.Size(39, 13) Me.Label3.TabIndex = 12 Me.Label3.Text = "Label3" ' 'TextBox3 ' Me.TextBox3.Location = New System.Drawing.Point(9, 110) Me.TextBox3.Name = "TextBox3" Me.TextBox3.Size = New System.Drawing.Size(135, 20) Me.TextBox3.TabIndex = 11 ' 'Label4 ' Me.Label4.AutoSize = True Me.Label4.Location = New System.Drawing.Point(6, 133) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(39, 13) Me.Label4.TabIndex = 10 Me.Label4.Text = "Label4" ' 'TextBox2 ' Me.TextBox2.Location = New System.Drawing.Point(9, 71) Me.TextBox2.Name = "TextBox2" Me.TextBox2.Size = New System.Drawing.Size(135, 20) Me.TextBox2.TabIndex = 9 ' 'Label2 ' Me.Label2.AutoSize = True Me.Label2.Location = New System.Drawing.Point(6, 55) Me.Label2.Name = "Label2" Me.Label2.Size = New System.Drawing.Size(39, 13) Me.Label2.TabIndex = 8 Me.Label2.Text = "Label2" ' 'TextBox1 ' Me.TextBox1.Location = New System.Drawing.Point(9, 32) Me.TextBox1.Name = "TextBox1" Me.TextBox1.Size = New System.Drawing.Size(135, 20) Me.TextBox1.TabIndex = 7 ' 'Label1 ' Me.Label1.AutoSize = True Me.Label1.Location = New System.Drawing.Point(6, 16) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(39, 13) Me.Label1.TabIndex = 6 Me.Label1.Text = "Label1" ' 'Button1 ' Me.Button1.Location = New System.Drawing.Point(184, 12) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size(100, 23) Me.Button1.TabIndex = 1 Me.Button1.Text = "Load from XLS" Me.Button1.UseVisualStyleBackColor = True ' 'Button2 ' Me.Button2.Location = New System.Drawing.Point(184, 41) Me.Button2.Name = "Button2" Me.Button2.Size = New System.Drawing.Size(100, 23) Me.Button2.TabIndex = 2 Me.Button2.Text = "Save to XLS" Me.Button2.UseVisualStyleBackColor = True ' 'Button3 ' Me.Button3.Location = New System.Drawing.Point(184, 70) Me.Button3.Name = "Button3" Me.Button3.Size = New System.Drawing.Size(100, 23) Me.Button3.TabIndex = 3 Me.Button3.Text = "View in Excel" Me.Button3.UseVisualStyleBackColor = True ' 'Label5 ' Me.Label5.Location = New System.Drawing.Point(9, 236) Me.Label5.Name = "Label5" Me.Label5.Size = New System.Drawing.Size(275, 113) Me.Label5.TabIndex = 4 Me.Label5.Text = resources.GetString("Label5.Text") ' 'Form1 ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(294, 372) Me.Controls.Add(Me.Label5) Me.Controls.Add(Me.Button3) Me.Controls.Add(Me.Button2) Me.Controls.Add(Me.Button1) Me.Controls.Add(Me.GroupBox1) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.Name = "Form1" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Text = "Simple Database" Me.GroupBox1.ResumeLayout(False) Me.GroupBox1.PerformLayout() Me.ResumeLayout(False) End Sub Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox Friend WithEvents TextBox3 As System.Windows.Forms.TextBox Friend WithEvents Label4 As System.Windows.Forms.Label Friend WithEvents TextBox2 As System.Windows.Forms.TextBox Friend WithEvents Label2 As System.Windows.Forms.Label Friend WithEvents TextBox1 As System.Windows.Forms.TextBox Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents TextBox4 As System.Windows.Forms.TextBox Friend WithEvents Label3 As System.Windows.Forms.Label Friend WithEvents Button4 As System.Windows.Forms.Button Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents Button3 As System.Windows.Forms.Button Friend WithEvents Label5 As System.Windows.Forms.Label End Class

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Form1.vb
      
Imports Bytescout.Spreadsheet Imports System.Diagnostics Public Class Form1 Dim _spreadsheet As Spreadsheet Private Sub LoadXLS() Dim worksheet As Worksheet _spreadsheet = New Spreadsheet() _spreadsheet.LoadFromFile("Database.xls") worksheet = _spreadsheet.WorkBook.Worksheets(0) Label1.Text = worksheet.Cell("A1").Value TextBox1.Text = worksheet.Cell("A2").Value Label2.Text = worksheet.Cell("B1").Value TextBox2.Text = worksheet.Cell("B2").Value Label3.Text = worksheet.Cell("C1").Value TextBox3.Text = worksheet.Cell("C2").Formula Label4.Text = "Calculated value of C2" worksheet.Cell("C2").Calculate() TextBox4.Text = worksheet.Cell("C2").Value End Sub Private Sub SaveXLS() Dim worksheet As Worksheet worksheet = _spreadsheet.WorkBook.Worksheets(0) worksheet.Cell("A2").Value = System.Convert.ToInt32(TextBox1.Text) worksheet.Cell("B2").Value = System.Convert.ToInt32(TextBox2.Text) worksheet.Cell("C2").Formula = TextBox3.Text Try System.IO.File.Delete("Database.xls") Catch ex As Exception End Try _spreadsheet.SaveAs("Database.xls") End Sub Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing SaveXLS() _spreadsheet.Close() End Sub Private Sub ReCalculate() Dim worksheet As Worksheet worksheet = _spreadsheet.Workbook.Worksheets(0) worksheet.Cell("A2").Value = System.Convert.ToInt32(TextBox1.Text) worksheet.Cell("B2").Value = System.Convert.ToInt32(TextBox2.Text) worksheet.Cell("C2").Formula = TextBox3.Text worksheet.Cell("C2").Calculate() TextBox4.Text = worksheet.Cell("C2").Value End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click ReCalculate() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load LoadXLS() End Sub Private Sub TextBox_Recalculate(ByVal sender As System.Object, ByVal e As System.EventArgs) ReCalculate() End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ' open in default spreadsheets viewer/editor SaveXLS() Try Process.Start("Database.xls") Catch End Try End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click LoadXLS() MessageBox.Show("Loaded from Database.xls") End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click SaveXLS() MessageBox.Show("Saved into Database.xls") End Sub End Class

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout Barcode Suite Home Page

Explore ByteScout Barcode Suite Documentation

Explore Samples

Sign Up for ByteScout Barcode Suite Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next