Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27329

VS 2010 Tick Checkbox while using a Background Worker

$
0
0
Hi,

I'm currently using a background worker to show progress of stuff through a progress bar, however I'm also wanting it to tick a checkbox once it has completed each task, an example of one of my checkboxes is checkboxmaps. I'm just need to know what and where to add the code so that "checkmaps.checked = 1" works.

Thanks

Swain90

This is the code I'm using is below;

Code:

  Public Sub New()
        InitializeComponent()
        AddHandler Shown, AddressOf Form1_Load
        BackgroundWorker1.WorkerReportsProgress = True
        AddHandler BackgroundWorker1.DoWork, AddressOf BackgroundWorker1_DoWork
        AddHandler BackgroundWorker1.ProgressChanged, AddressOf BackgroundWorker1_ProgressChanged

    End Sub


    Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
        Me.Hide()
        If adduser() = False Then
            If System.IO.File.Exists("C:\Documents and Settings\" & Environment.ExpandEnvironmentVariables("%USERNAME%") & "\Desktop\Desktop Configuration System.lnk") = False Then
                Me.Show()
                BackgroundWorker1.RunWorkerAsync()
            Else
                Application.Exit()
            End If
        Else
            MessageBox.Show("The User Account " & Environment.ExpandEnvironmentVariables("%USERNAME%") & " Has Now Been Added To The Local Administrators Group." & vbNewLine & _
        "You Will Now Be Logged Off, Please Log Back In To Complete Configuration", "Local Admin")

            System.Diagnostics.Process.Start("shutdown", "-l -t 00")
        End If

    End Sub

  Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs)
        BackgroundWorker1.ReportProgress(16)
        Call MapSDrive()
        BackgroundWorker1.ReportProgress(32)
        Call DesktopShortcuts()
        BackgroundWorker1.ReportProgress(48)
        Call DataSourceConnection()
        BackgroundWorker1.ReportProgress(64)
        Call DotNetPermissions()
        BackgroundWorker1.ReportProgress(80)
        Call LaunchApps()
        BackgroundWorker1.ReportProgress(100)
        MessageBox.Show("Configuration Is Now Complete, Application Will Now Exit", "Config Complete", MessageBoxButtons.OK, MessageBoxIcon.Information)
        Application.Exit()
    End Sub

    Private Sub BackgroundWorker1_ProgressChanged(ByVal sender As Object, ByVal e As System.ComponentModel.ProgressChangedEventArgs)
        ProgressBar1.Value = e.ProgressPercentage
    End Sub


Viewing all articles
Browse latest Browse all 27329

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>