Group, Today I learned with Me.Cursor = Cursors.WaitCursor and Me.Cursor = Cursors.Default do. I've seen other programs, when running, a "message box" comes up and let's the user know what in the routine is happening. If it's possible to do in VB.net, I'd like to do the same thing. However I know I don't want to use a true MessageBox as I don't want the user to have to click OK each time. But it would be nice for them to see each "stage" of the progress being made. Is that possible? If so, how is this done. Can you suggest where I might see some examples?

In advance, thanks again for the help.

Don

One of the many choices is the label tool, for example when i install a game, there's a label under the progress bar that changes its text along with the progress, from "copying files to.." to "installing x.." to "installation complete".
Label.text = "String"

Windows Forms applications can also use the ProgressBar class.

If this is a long-running task, are you performing work in a background thread? Consider the BackgroundWorker class if you haven't already; it works nicely with progress bars and labels.

I don't want to use a true MessageBox as I don't want the user to have to click OK each time

I agree 110%; I'd never use a message box in something that will be seen by actual users. There are always better ways to handle the communication.

oussama_1 is right. Take a label control to display the string or working percentage and take a progress bar to visualize the working percentage.

Aalabel control has Text Property to display any text. But you must set 3 to 4 properties of a progressbar to get the proper visualization.

ProgressBar Properties
Minimum Property -> The lower bound of the range the progressbar is working with.
MAximum Property -> The upper bound of the range the progressbar is working with.
Step Property -> The amount to increment the current value of the control.
Style Property-> The property allows the user to set the style of the progressbar.

I describe here a simple progressing example.
I take here two forms Form1 & Form2.
On Form1, it has a button .Clicking it the process starts. And on Form2, it has a ProgressBar Control and two label Control to show the progress percentage.
The codes against form2 are

Public Class Form2

    'declaring custom property of the form 

    'To set minimum value
    Public Property Min() As Integer
        Get
            Return ProgressBar1.Minimum
        End Get
        Set(value As Integer)
            ProgressBar1.Minimum = value
        End Set
    End Property

    'To set Maximum value
    Public Property Max() As Integer
        Get
            Return ProgressBar1.Maximum
        End Get
        Set(value As Integer)
            ProgressBar1.Maximum = value
        End Set
    End Property

    'to set progress value
    Public Property Value() As Integer
        Get
            Return ProgressBar1.Value
        End Get
        Set(value As Integer)
            'incrementing the current value
            ProgressBar1.Increment(value)

            'Show the progress percentage
            Label2.Text = Math.Floor((100 * ProgressBar1.Value / ProgressBar1.Maximum)) & "%"
        End Set
    End Property

End Class

And the codes against Form1 are

Public Class Form1
    'Declaring Variable
    Dim msgForm As Form2

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        'Try to show a new form
        'and set the property values
        msgForm = New Form2
        msgForm.Min = 0
        msgForm.Max = 10000
        msgForm.Show()

        'Making a loop to increment progressbar value.
        For i As Integer = 0 To 10000
            msgForm.Value = 1
            Application.DoEvents()

        Next
    End Sub
End Class

It is just a simple example to show how can a ProgressBar Control works.
There are too many process to show your progress.
Hope it can help you.

Edited 1 Year Ago by Shark_1

Attachments Capture2.PNG 6.23 KB Capture1.PNG 4.6 KB

Group,

Thank you. I've got a little more research and testing to do. But now you've pointed me in the right direction. I'll report back as to what I do. Thanks for your help again!

Don

It sounds like creating a new form for your display of the progress (maybe with a progress bar and some lables to tell the user what is going on) would be a good soultion. You can even up the window in the center of the new forum (form properties)

Hope this help

This article has been dead for over six months. Start a new discussion instead.