Public Class Form1 #Region " Windows Form Designer generated code " #End Region Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load Try Dim ConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = F:\Rahul\Teaching\Northwind.mdb" Dim ObjConn As New OleDb.OleDbConnection(ConnStr) Dim dt As New DataTable Dim SqlStr As String = "Select OrderID as ID from Orders" Dim ObjCmmd As New OleDb.OleDbCommand(SqlStr, ObjConn) Dim ObjDA As New OleDb.OleDbDataAdapter(ObjCmmd) ObjDA.Fill(dt) Dim i As Integer For i = 0 To dt.Rows.Count - 1 ComboBox1.Items.Add(dt.Rows(i)(0)) Next Catch ex As Exception MessageBox.Show("Exception: " + ex.Message) End Try End Sub Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click Try Dim ConnStr As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = F:\Rahul\Teaching\Northwind.mdb" Dim ObjConn As New OleDb.OleDbConnection(ConnStr) Dim dt As New DataTable Dim SqlStr As String = "Select count(*), sum(UnitPrice * Quantity) from [order details] where orderid=" SqlStr += Convert.ToString(ComboBox1.SelectedItem) Dim ObjCmmd As New OleDb.OleDbCommand(SqlStr, ObjConn) Dim ObjDA As New OleDb.OleDbDataAdapter(ObjCmmd) ObjDA.Fill(dt) Dim PreTotal As Double = dt.Rows(0)(1) Dim NItems As Integer = dt.Rows(0)(0) Dim Discount As Double = 0 Dim Shipping As Double = 0 Dim OrderTotal As Double = 0 Shipping = 0.1 * PreTotal If (NItems >= 3 And NItems < 5) Then Discount = 0.1 * PreTotal ElseIf (NItems >= 5) Then Discount = 0.15 * PreTotal Shipping = 0 End If OrderTotal = PreTotal - Discount + Shipping lblPreTotal.Text = FormatCurrency(PreTotal) lblDiscount.Text = FormatCurrency(Discount) lblShipping.Text = FormatCurrency(Shipping) lblOrderTotal.Text = FormatCurrency(OrderTotal) Catch ex As Exception MessageBox.Show("Exception: " + ex.Message) End Try End Sub End Class