locked
Simple advice needed for progression user alerts RRS feed

  • Question

  • So I have a UI that when the user selects a particular encounter, it goes out, runs eight different procedures to get data and format that data into HTML files and presents it into a separate window's WebView controls that are on eight different tabs in a tab container (get it?)...so anyway running these eight procedures does take more than a moment (but probably less than two minutes) and what I would like is to have the original calling form display the procedure that is currently being processed and update a progress bar (that I have set a maximum of 8, one for each procedure). 

    I have tried understanding and using threads, but because I just want to update a label with text and step the progress bar 1, it seems like that should work, but it is not.  I do have the default cursor displaying as a "wait" spinner and then going back to default after completion and that is working, but I want something that is more in the users face saying "hey, I am working here.  Please dont close me yet as I am busy getting data"

    Thanks for the advice

    Brad


    Brad Allison

    Thursday, July 30, 2020 1:56 PM

Answers

All replies

  • Hi

    You say 'it seems like that should work, but it is not' - that tells us nothing.  You are a mechanic and I ask you in a telephone call, that mu car doesn'r work so what do I do to fix it?  What fo you think the mechanic would say to that?


    Regards Les, Livingston, Scotland

    Thursday, July 30, 2020 2:07 PM
  • Sorry about that.  The label does not reset any text showing the procedure being processed nor does the progress bar update at all.  The procedures to process and the window with the data does eventually open as it should.

    Brad Allison

    Thursday, July 30, 2020 2:12 PM
  • Hi

    Still not enough - you will need to post your code - at least the relevant code if all code is too large.


    Regards Les, Livingston, Scotland

    Thursday, July 30, 2020 2:21 PM
  • If this is a windows form project, rather than use threads have you considered asynchronous operations which use delegates and events to perform work while sending information back to the caller? Also, it's easier to perform cancellations on async operations too.

    In the following link I show how to perform a "do nothing" operation in a class called from a form while doing so update a progress bar (in the calling form) along with the ability to cancel the operation

    https://github.com/karenpayneoregon/async-basics-vb/tree/master/AsynchronousCancellationTokenSample

    There are other code samples here

    https://github.com/karenpayneoregon/async-basics-vb

    If this is not windows forms but WPF then ask here

    https://docs.microsoft.com/en-us/answers/topics/windows-wpf.html


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Thursday, July 30, 2020 2:23 PM