By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,347 Members | 2,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,347 IT Pros & Developers. It's quick & easy.

How to use Progress Bar while processing an application.

P: 9
Expand|Select|Wrap|Line Numbers
  1. Private Sub IDfield_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles IDfield.KeyPress
  2.  
  3.         If Asc(e.KeyChar) = Keys.Enter Then
  4.             If IDfield.Text = Nothing Then
  5.                 MsgBox("Dont forget to enter the Operator ID")
  6.             ElseIf IDfield.Text.Length < 4 Then
  7.                 MsgBox("Operator ID must have 4 to 8 characters")
  8.             Else
  9.  
  10.                 Dim samplefrmt As Integer = 0
  11.                 BatSizenew = Form1.BatSize.Text
  12.                 BatSizenew = CInt(Int(Form1.BatSize.Text))
  13.  
  14.                 For ya As Integer = 0 To Form1.SelBat.Items.Count - 1
  15.                     Timer1.Start()
  16.                     Timer1.Stop()
  17.                     rec1 = 1
  18.  
  19.                     Dim imgCount As Integer = Val(Form1.SelBat.Items(ya).SubItems(1).Text)
  20.                     Dim batSz As Integer = Val(Form1.BatSize.Text)
  21.  
  22.                     Dim dbCount As Integer = CInt(Math.Ceiling(imgCount / batSz))
  23.  
  24.                     Dim batchFolderName As String = Form1.SelBat.Items(ya).SubItems(0).Text
  25.  
  26.                     Dim batchFolderDirectory As String = Form1.Dir_folder.Text & "\DDC OS" & "\CARD DECK" & "\" & DateTime.Now.ToString("yyyyMMdd") & "\" & batchFolderName
  27.                     Dim testPath1 As String = batchFolderDirectory & "\Compare"
  28.                     Dim testPath5 As String = batchFolderDirectory & "\Entry1"
  29.                     Dim testPath2 As String = batchFolderDirectory & "\Entry2"
  30.                     Dim testPath3 As String = batchFolderDirectory & "\Images"
  31.                     Dim testPath4 As String = Form1.Dir_folder.Text & "\CBATCH"
  32.                     Dim testPath6 As String = Form1.Dir_folder.Text & "\CBATCH" & "\CardDeck" & "\" & DateTime.Now.ToString("yyyyMMdd")
  33.                     Dim ncbpth As String = testPath6 & "\" & Form1.SelBat.Items(ya).SubItems(0).Text & ".mdb"
  34.                     Dim ncbtext As String = testPath6 & "\" & Form1.SelBat.Items(ya).SubItems(0).Text & ".txt"
  35.  
  36.                     If Directory.Exists(batchFolderDirectory) Then
  37.                         Dim ans As DialogResult = MessageBox.Show("Already contains a folder name", "Do you want to Overwrite?", MessageBoxButtons.YesNoCancel)
  38.                         If ans = Windows.Forms.DialogResult.Yes Then
  39.                             Try
  40.                                 Timer1.Start()
  41. aldrin:                         Directory.Delete(batchFolderDirectory, True)
  42.                             Catch ex As Exception
  43.                                 MsgBox(ex.Message, MsgBoxStyle.Critical)
  44.                                 Application.Exit()
  45.  
  46.                             End Try
  47.                             IO.File.Delete(ncbpth)
  48.                             IO.File.Delete(ncbtext)
  49.  
  50.                         ElseIf ans = Windows.Forms.DialogResult.No Then
  51.                             'Timer1.Stop()
  52.                             'Form1.ProgressBar1.Value = 0
  53.                             Continue For
  54.                         Else
  55.                             'Timer1.Stop()
  56.                             'Form1.ProgressBar1.Value = 0
  57.                             Exit For
  58.                         End If
  59.                     End If
  60.  
  61.                     If Not IO.Directory.Exists(testPath5) Then
  62.                         MkDir(testPath5)
  63.                     End If
  64.                     If Not IO.Directory.Exists(testPath1) Then
  65.                         MkDir(testPath1)
  66.                     End If
  67.                     If Not IO.Directory.Exists(testPath2) Then
  68.                         MkDir(testPath2)
  69.                     End If
  70.                     If Not IO.Directory.Exists(testPath3) Then
  71.                         MkDir(testPath3)
  72.                     End If
  73.                     If Not IO.Directory.Exists(testPath4) Then
  74.                         MkDir(testPath4)
  75.                     End If
  76.                     If Not IO.Directory.Exists(testPath6) Then
  77.                         MkDir(testPath6)
  78.                     End If
  79.  
  80.                     dir = testPath1
  81.  
  82.                     Dim cbatpath As String = Form1.SelBat.Items(ya).SubItems(0).Text
  83.                     Dim file As System.IO.StreamWriter
  84.                     Dim s As String
  85.                     Dim u As String
  86.                     s = Form1.SelBat.Items(ya).SubItems(2).Text & "\" & Form1.SelBat.Items(ya).SubItems(0).Text
  87.                     u = IDfield.Text
  88.  
  89.                     file = My.Computer.FileSystem.OpenTextFileWriter(testPath6 & "\" & cbatpath & ".txt", False)
  90.                     file.WriteLine("Client name         :       DDC OS")
  91.                     file.WriteLine("Job name            :       CARD DECK")
  92.                     file.WriteLine("Programmer name     :       Jeramiel Ortega")
  93.                     file.WriteLine("Project Coordinator :       Marites Santos")
  94.                     file.WriteLine("Date                :       " & Format(Now, "f"))
  95.                     file.WriteLine("Shipment/Zipfile    :       " & s)
  96.                     file.WriteLine("Batch by(OperID)    :       " & u)
  97.                     file.WriteLine("Directory Compare   :       " & testPath1)
  98.                     file.WriteLine("Directory Entry1    :       " & testPath5)
  99.                     file.WriteLine("Directory Entry2    :       " & testPath2)
  100.                     file.WriteLine("Directory Images    :       " & testPath3)
  101.                     file.WriteLine("Date Received       :       _____________________________")
  102.                     file.WriteLine("Output Date         :       _____________________________")
  103.                     file.WriteLine("DE Target           :       _____________________________")
  104.                     file.WriteLine("QC Target           :       _____________________________")
  105.                     file.WriteLine("Val Target          :       _____________________________")
  106.                     file.WriteLine("")
  107.                     file.WriteLine(String.Format("{0,0} {1,23} {2,15} {3,15}", "MDB Names", "Start Record", "End Record", "BatchCount"))
  108.  
  109.                     catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" + testPath6 + "\" & cbatpath & ".mdb")
  110.                     '***********************CBATCH TABLE**********************************
  111.                     conctn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
  112.                                       "  Data Source=" + testPath6 + "\" & cbatpath & ".mdb")
  113.  
  114.                     Dim cmnd As New OleDb.OleDbCommand("CREATE TABLE CardDeck( " & _
  115.                        "RecNum int identity," & "ZipFile NVarchar(50)," & "DvdName NVarchar(50)," & "BatchNo NVarchar(50)," & "OImage001 NVarchar(50)," & _
  116.                     "Image001 NVarchar(50)," & "CONSTRAINT [pk_RecNum] PRIMARY KEY (RecNum)) ", conctn)
  117.                     conctn.Open()
  118.                     cmnd.ExecuteNonQuery()
  119.                     'conctn.Close()
  120.                     '******************************ENDS HERE!! ****************************
  121.  
  122.                     '************DB PER BATSIZE*************
  123.                     Dim imageNum As Integer = 0
  124.                     Dim ss As Integer = 0
  125.                     '2ND LOOP HERE
  126.                     For i As Integer = 0 To dbCount - 1
  127.  
  128.                         catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" + dir + "\" & Format(i + 1, "00000000") & ".mdb")
  129.  
  130.                         conn = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
  131.                       "  Data Source=" + dir + "\" & Format(i + 1, "00000000") & ".mdb")
  132.                         Dim cmd As New OleDb.OleDbCommand("CREATE TABLE Data001( " & _
  133.                            "RecNum int identity," & "PullOut int," & "Title NVarchar(50)," & "Firstname NVarchar(50)," & "Surname NVarchar(50)," & _
  134.                         "Address1 NVarchar(50)," & "Address2 NVarchar(50)," & "Address3 NVarchar(50)," & "County NVarchar(50)," & "Postcode text," & _
  135.                         "QaskFlag NVarchar(50)," & "Telephone number," & "Mobile number," & "Email NVarchar(50)," & "DOB NVarchar(50)," & "Field001 NVarchar(50)," & _
  136.                         "Field002 NVarchar(50)," & "Field003 NVarchar(50)," & "Field004 NVarchar(50)," & "Field005 NVarchar(50)," & "CONSTRAINT [pk_RecNum] PRIMARY KEY (RecNum)) ", conn)
  137.                         conn.Open()
  138.                         cmd.ExecuteNonQuery()
  139.  
  140.                         Dim cmd1 As New OleDb.OleDbCommand("CREATE TABLE CardDeck ( " & _
  141.                      "RecNum int identity," & "ZipFile NVarchar(50)," & "DvdName NVarchar(50)," & "BatchNo NVarchar(50)," & "PullOut int," & _
  142.                       "RefInd int," & "KeyFlag NVarchar(50)," & "KeyId NVarchar(50)," & "KeyDate NVarchar(50)," & "VerFlag NVarchar(50)," & "VerID NVarchar(50)," & _
  143.                     "VerDate int," & "ComFlag int," & "ComID NVarchar(50)," & "ComDate NVarchar(50)," & "UpdFlag NVarchar(50)," & "UpdID NVarchar(50)," & _
  144.                     "UpdDate NVarchar(50)," & "QCFlag NVarchar(50)," & "QCID NVarchar(50)," & "QCDate NVarchar(50)," & "QASFlag NVarchar(50)," & _
  145.                     "QASID NVarchar(50)," & "QASDate NVarchar(50)," & "ValFlag NVarchar(50)," & "ValID NVarchar(50)," & "ValDate NVarchar(50)," & _
  146.                     "RefFlag NVarchar(50)," & "RefID NVarchar(50)," & "RefDate NVarchar(50)," & "Accuracy1 NVarchar(50)," & "Accuracy2 NVarchar(50)," & _
  147.                     "Accuracy3 NVarchar(50)," & "Accuracy4 NVarchar(50)," & "Accuracy5 NVarchar(50)," & "KSCount NVarchar(50)," & "QCID1 NVarchar(50)," & _
  148.                    "QCID2 NVarchar(50)," & "QCID3 NVarchar(50)," & "QCID4 NVarchar(50)," & "QCID5 NVarchar(50)," & "LKFlag1 NVarchar(50)," & _
  149.                     "LKFlag2 NVarchar(50)," & "LKFlag3 NVarchar(50)," & "LKFlag4 NVarchar(50)," & "LKFlag5 NVarchar(50)," & "LocId1 NVarchar(50)," & _
  150.                     "LocId2 NVarchar(50)," & "OImage001 NVarchar(250)," & "Image001 Varchar(150)," & "CONSTRAINT [pk_RecNum] PRIMARY KEY (RecNum)) ", conn)
  151.                         cmd1.ExecuteNonQuery()
  152.  
  153.                         dir2 = Form1.Dir_folder.Text + "\CBATCH"
  154.                         Dim ost As String
  155.                         Dim dbinsert As String = "00000000.##"
  156.                         samplefrmt = samplefrmt + 1
  157.                         ost = samplefrmt.ToString(dbinsert) & ".mdb"
  158.  
  159.                         Form1.FileListBox1.Path = Form1.SelBat.Items(ya).SubItems(2).Text & "\" & Form1.SelBat.Items(ya).SubItems(0).Text
  160.  
  161.                         Dim src As String
  162.                         Dim bS As String = Form1.SelBat.Items(ya).SubItems(2).Text & "\" & Form1.SelBat.Items(ya).SubItems(0).Text
  163.                         Dim dest As String
  164.  
  165.                         Form1.FileListBox1.Path = Form1.SelBat.Items(ya).SubItems(2).Text & "\" & Form1.SelBat.Items(ya).SubItems(0).Text
  166.  
  167.                         Dim imgFrmt As String = "00000000.##"
  168.  
  169.                         Dim flcount As Integer = Form1.FileListBox1.Items.Count
  170.                         Dim pieces As Integer = 0
  171.  
  172.                         Dim ssfrmt As String = ""
  173.                         '3rd loop
  174.                         For n As Integer = imageNum To flcount - 1
  175.                             pieces = pieces + 1
  176.  
  177.                             Dim op As String = Form1.Dir_folder.Text & "\DDC OS" & "\CARD DECK" & "\" & DateTime.Now.ToString("yyyyMMdd") & "\" & batchFolderName & "\Images"
  178.                             ss = ss + 0
  179.                             Dim sam As String
  180.                             imageNum = imageNum + 1
  181.                             src = bS + "\" + Form1.FileListBox1.Items(n).ToString
  182.                             dest = op + "\" + imageNum.ToString(imgFrmt) & ".tif"
  183.                             System.IO.File.Copy(src, dest, True)
  184.  
  185.                             k = imageNum.ToString(imgFrmt) & ".tif"
  186.                             f = Form1.FileListBox1.Items(n).ToString
  187.                             d = Form1.SelBat.Items(ya).SubItems(0).Text
  188.                             Dim filePath As String = Form1.SelBat.Items(ya).SubItems(2).Text
  189.                             Dim directory As String = Path.GetDirectoryName(filePath)
  190.                             Dim split As String() = filePath.Split("\")
  191.                             Dim parentFolder As String = split(split.Length - 1)
  192.                             c = parentFolder
  193.  
  194.                             Dim cmdB1 As String = "INSERT INTO [CardDeck] ([ZipFile],[DvdName],[BatchNo],[RefId],[VerFlag],[ComFlag],[UpdFlag],[QCFlag],[QASFlag],[ValFlag],[RefFlag],[LKFlag1],[LKFlag2],[LKFlag3],[LKFlag4],[LKFlag5],[OImage001],[Image001]) VALUES (@ZipFile, @DvdName, @BatchNo, @RefId, @VerFlag, @ComFlag, @UpdFlag, @QCFlag, @QASFlag, @ValFlag, @RefFlag, @LKFlag1, @LKFlag2, @LKFlag3, @LKFlag4, @LKFlag5, @OImage001, @Image001);"
  195.                             Dim cmdG1 As New OleDb.OleDbCommand(cmdB1, conn)
  196.                             cmdG1.Parameters.AddWithValue("@ZipFile", d)
  197.                             cmdG1.Parameters.AddWithValue("@DvdName", c)
  198.                             cmdG1.Parameters.AddWithValue("@BatchNo", "0000001")
  199.                             cmdG1.Parameters.AddWithValue("@ReFId", "0")
  200.                             cmdG1.Parameters.AddWithValue("@VerFlag", "0")
  201.                             cmdG1.Parameters.AddWithValue("@ComFlag", "0")
  202.                             cmdG1.Parameters.AddWithValue("@UpdFlag", "0")
  203.                             cmdG1.Parameters.AddWithValue("@QCFlag", "0")
  204.                             cmdG1.Parameters.AddWithValue("@QASFlag", "0")
  205.                             cmdG1.Parameters.AddWithValue("@ValFlag", "0")
  206.                             cmdG1.Parameters.AddWithValue("@RefFlag", "0")
  207.                             cmdG1.Parameters.AddWithValue("@LKFlag1", "0")
  208.                             cmdG1.Parameters.AddWithValue("@LKFlag2", "0")
  209.                             cmdG1.Parameters.AddWithValue("@LKFlag3", "0")
  210.                             cmdG1.Parameters.AddWithValue("@LKFlag4", "0")
  211.                             cmdG1.Parameters.AddWithValue("@LKFlag5", "0")
  212.                             cmdG1.Parameters.AddWithValue("@OImage001", f)
  213.                             cmdG1.Parameters.AddWithValue("@Image001", k)
  214.  
  215.                             cmdG1.ExecuteNonQuery()
  216.                             sam = ss.ToString(ssfrmt)
  217.  
  218.                             Dim cmdB As String = ("INSERT INTO [Data001] ([PullOut],[QaskFlag],[Field001],[Field002],[Field003],[Field004],[Field005]) VALUES (@PullOut,@QaskFlag,@Field001,@Field002,@Field003,@Field004,@Field005)")
  219.                             Dim cmdG As New OleDb.OleDbCommand(cmdB, conn)
  220.                             cmdG.Parameters.AddWithValue("@PullOut", "0")
  221.                             cmdG.Parameters.AddWithValue("@QaskFlag", "0")
  222.                             cmdG.Parameters.AddWithValue("@Field001", "0")
  223.                             cmdG.Parameters.AddWithValue("@Field002", "0")
  224.                             cmdG.Parameters.AddWithValue("@Field003", "0")
  225.                             cmdG.Parameters.AddWithValue("@Field004", "0")
  226.                             cmdG.Parameters.AddWithValue("@Field005", sam)
  227.                             cmdG.ExecuteNonQuery()
  228.  
  229.                             '**********************CBATCH INSERT FIELDS VALUE*******************
  230.                             Dim cmdB3 As String = "INSERT INTO [CardDeck] ([ZipFile],[DvdName],[BatchNo],[OImage001],[Image001]) VALUES (@ZipFile, @DvdName, @BatchNo, @OImage001, @Image001);"
  231.                             Dim cmdG3 As New OleDb.OleDbCommand(cmdB3, conctn)
  232.                             cmdG3.Parameters.AddWithValue("@ZipFile", d)
  233.                             cmdG3.Parameters.AddWithValue("@DvdName", c)
  234.                             cmdG3.Parameters.AddWithValue("@BatchNo", "00000001")
  235.                             cmdG3.Parameters.AddWithValue("@OImage001", f)
  236.                             cmdG3.Parameters.AddWithValue("@Image001", k)
  237.                             cmdG3.ExecuteNonQuery()
  238.  
  239.                             '****************************ENDS HERE!!!****************************
  240.                             rec2 += 1
  241.  
  242.                             If pieces = batSz Then
  243.                                 Exit For
  244.                             End If
  245.                             Timer1.Start()
  246.                         Next n
  247.                         bS = Form1.SelBat.Items(ya).SubItems(2).Text & "\" & Form1.SelBat.Items(0).SubItems(0).Text
  248.  
  249.                         Dim tt As String = testPath1
  250.  
  251.                         CType(catNewDB.ActiveConnection, ADODB.Connection).Close()
  252.  
  253.                         My.Computer.FileSystem.CopyDirectory(tt, testPath5, True)
  254.                         My.Computer.FileSystem.CopyDirectory(tt, testPath2, True)
  255.  
  256.  
  257.                         '**CBATCH LOG about databases created****************
  258.                         file.WriteLine(String.Format("{0,5} {1,15} {2,15} {3,15}", Format(i + 1, "00000000") & ".mdb", rec1.ToString, rec2.ToString, batSz))
  259.                         rec1 = rec2 + 1
  260.                         rec2 = rec2
  261.  
  262.                         conn.Close()
  263.                         GC.Collect()
  264.                         GC.WaitForPendingFinalizers()
  265.  
  266.                         conn.Open()
  267.                         conn.Close()
  268.                         GC.Collect()
  269.                         GC.WaitForPendingFinalizers()
  270.  
  271.                         Application.DoEvents()
  272.                     Next
  273.                     file.Close()
  274.                     rec2 = 0
  275.                     Application.DoEvents()
  276.                 Next
  277.  
  278.                 Me.Close()
  279.                 ' Timer1.Start()
  280.             End If
  281.  
  282.             Dim newpath As String = Form1.Dir_folder.Text & "\CBATCH"
  283.             If Not IO.Directory.Exists(newpath) Then
  284.                 MkDir(newpath)
  285.             End If
  286.  
  287.             conns = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" + newpath + "\CardDeck.mdb")
  288.  
  289.             If Not File.Exists(newpath + "\CardDeck.mdb") Then
  290.                 catNewDB.Create("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" + newpath + "\CardDeck.mdb")
  291.                 Dim cmdd As New OleDb.OleDbCommand("CREATE TABLE CardDeck( " & _
  292.                    "RecNum int identity," & "ZipFile NVarchar(50)," & "DvdName NVarchar(50)," & "SeqNo1 NVarchar(50)," & "SeqNo2 NVarchar(50)," & _
  293.                 "JobCode NVarchar(50)," & "ClientCode NVarchar(50)," & "TotalImages NVarchar(50)," & "TotalRecs NVarchar(50)," & "BatchCount NVarchar(50)," & "BatchDate NVarchar(50)," & "BatchSize NVarchar(50)," & "CONSTRAINT [pk_RecNum] PRIMARY KEY (RecNum)) ", conns)
  294.                 conns.Open()
  295.  
  296.                 cmdd.ExecuteNonQuery()
  297.  
  298.                 conns.Close()
  299.                 GC.Collect()
  300.                 GC.WaitForPendingFinalizers()
  301.             End If
  302.  
  303.             For ast As Integer = 0 To Form1.SelBat.Items.Count - 1
  304.  
  305.                 Dim o As String
  306.                 o = Form1.SelBat.Items(ast).SubItems(0).Text()
  307.                 Dim y As String
  308.                 Dim fPath As String = Form1.SelBat.Items(ast).SubItems(2).Text
  309.                 Dim directory3 As String = Path.GetDirectoryName(fPath)
  310.                 Dim split As String() = fPath.Split("\")
  311.                 Dim exfldr As String = split(split.Length - 1)
  312.                 y = exfldr
  313.  
  314.                 Dim count As String = Form1.SelBat.Items(ast).SubItems(1).Text
  315.                 Dim newbatsize As String
  316.                 newbatsize = Form1.BatSize.Text
  317.  
  318.                 Dim batchFolderNames As String = Form1.SelBat.Items(ast).SubItems(0).Text
  319.                 Dim fldr As String = Form1.Dir_folder.Text & "\CBATCH"
  320.                 Dim countOfMdb = Directory.GetFiles(fldr, "*.mdb", System.IO.SearchOption.AllDirectories).Length
  321.  
  322.                 Dim cmdB1 As String = "INSERT INTO [CardDeck] ([ZipFile],[DvdName],[SeqNo1],[SeqNo2],[JobCode],[ClientCode],[TotalImages],[TotalRecs],[BatchCount],[BatchDate],[BatchSize]) VALUES (@ZipFile, @DvdName, @SeqNo1, @SeqNo2, @JobCode, @ClientCode, @TotalImages, @TotalRecs, @BatchCount, @BatchDate, @BatchSize);"
  323.                 Dim cmdG1 As New OleDb.OleDbCommand(cmdB1, conns)
  324.                 cmdG1.Parameters.AddWithValue("@ZipFile", o)
  325.                 cmdG1.Parameters.AddWithValue("@DvdName", y)
  326.                 cmdG1.Parameters.AddWithValue("@SeqNo1", "00000001")
  327.                 cmdG1.Parameters.AddWithValue("@SeqNo2", "00000001")
  328.                 cmdG1.Parameters.AddWithValue("@JobCode", "Card Deck")
  329.                 cmdG1.Parameters.AddWithValue("@ClientCode", "DDC OS")
  330.                 cmdG1.Parameters.AddWithValue("@TotalImages", count)
  331.                 cmdG1.Parameters.AddWithValue("@TotalRecs", count)
  332.                 cmdG1.Parameters.AddWithValue("@BatchCount", countOfMdb)
  333.                 cmdG1.Parameters.AddWithValue("@BatchDate", Format(Now, "f"))
  334.                 cmdG1.Parameters.AddWithValue("@BatchSize", newbatsize)
  335.  
  336.                 conns.Open()
  337.  
  338.                 cmdG1.ExecuteNonQuery()
  339.  
  340.                 conns.Close()
  341.  
  342.                 GC.Collect()
  343.                 GC.WaitForPendingFinalizers()
  344.                 IDfield.Clear()
  345.             Next
  346.         End If
  347.  
  348.  
  349.  
  350.     End Sub
  351.  
  352.  
  353.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
  354.  
  355.         Form1.ProgressBar1.Increment(1)
  356.  
  357.         If Form1.ProgressBar1.Value = 25 Then
  358.             Form1.Label8.Text = "Started. Doing something"
  359.         ElseIf Form1.ProgressBar1.Value = 50 Then
  360.             Form1.Label8.Text = "Half Way There"
  361.         ElseIf Form1.ProgressBar1.Value = 75 Then
  362.             Form1.Label8.Text = "Working on it.. Almost Done!"
  363.         End If
  364.  
  365.         If Form1.ProgressBar1.Value = Form1.ProgressBar1.Maximum Then
  366.             Timer1.Stop()
  367.  
  368.             MsgBox("Complete!")
  369.             Form1.ProgressBar1.Value = 0
  370.  
  371.             Form1.Label8.Text = "Idle"
  372.             Button1.Enabled = True  '
  373.             If conns.State = ConnectionState.Open Then
  374.  
  375.                 conns.Close()
  376.                 GC.Collect()
  377.                 GC.WaitForPendingFinalizers()
  378.  
  379.             End If
  380.             If conn.State = ConnectionState.Open Then
  381.                 conn.Close()
  382.                 GC.Collect()
  383.                 GC.WaitForPendingFinalizers()
  384.             End If
  385.             If conctn.State = ConnectionState.Open Then
  386.                 conctn.Close()
  387.                 GC.Collect()
  388.                 GC.WaitForPendingFinalizers()
  389.             End If
  390.  
  391.  
  392.         End If
  393.  
  394.  
  395.     End Sub
  396.  
  397.  
  398.  
The above codes was my code, and I'm about to use progressbar while processing the application i made.
Jan 29 '16 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.