none
Counter/Timer & setting Data Types help RRS feed

  • Question

  • Hi all,

    I'm new to coding and in my study we are using VB's Window Forms (.NET Framework) to get us started in class. We've got a project where we need to set a data type (sByte, Short, Uinteger etc.) to show how it affects speed of the counting between chosen numbers entered into text boxes. At the moment my form has a combobox with the different data types, Start & End text boxes for the number range, a results text box that I want the time taken to display in and a Go button.

    What I'm wanting to ask is where do I go from here? ie

    How do I code a timer/stopwatch? 

    How do I set different data types?

    and How do I have the timer/stopwatch display how long it took to count between the chosen numbers in the "results" Text box?

    Sorry for the wordy question, any help is much appreciated :)

    Monday, April 23, 2018 2:08 AM

All replies

  • Hello,

    When it comes to homework/study we are here to assist with coding issues, not to answer questions such as the ones your asking now. 


    Please remember to mark the replies as answers if they help and unmark 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.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Monday, April 23, 2018 9:10 AM
    Moderator
  • Hi,

    Please search web, and you will many samples.

    Regards,


    Ashidacchi -- http://hokusosha.com/

    Monday, April 23, 2018 9:34 AM
  • How do I set different data types?

    You declare a variable of the appropriate type.  Then use that variable to do the counting.  See:

    https://docs.microsoft.com/en-us/dotnet/visual-basic/programming-guide/language-features/variables/variable-declaration

    How do I have the timer/stopwatch display how long it took to count between the chosen numbers in the "results" Text box?

    It will be a stopwatch, not a timer.  See the example here:

    https://msdn.microsoft.com/en-us/library/system.diagnostics.stopwatch(v=vs.110).aspx

    Convert the result to a string and set the text property of the text box.

    Monday, April 23, 2018 10:22 PM
  • What does "count between the chosen numbers in the "results" Text Box" mean?

    Dim SW As New StopWatch

    Didn't your instructor provide you with instruction on how to implement a stopwatch and do the other things in some ways before assigning you a task?


    La vida loca

    Monday, April 23, 2018 10:39 PM