Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Newbie looking for direction

Newbie looking for direction

Scheduled Pinned Locked Moved Visual Basic
7 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mxrobuk
    wrote on last edited by
    #1

    Hi Guys, just loaded vb 2005 onto my PC to start a project for a local club. Basically they wish to record times that a competitor crosses the line. Each competitor will have enough time in between them to allow the user to enter competitor number. I have created a text box for the user to enter rider number, a timer that updates with current system time, and when user clicks button it records the rider number and time the button was clicked. Nice and simple. But, whats the best way to allow this for 100 competitors, for the programme to record each one on a separate line. The data will also need saving, but Im not that far yet so really just looking for guidence on where to go from just 1 single input to infinte inputs. Many thanks in advance

    0 M L 3 Replies Last reply
    0
    • M mxrobuk

      Hi Guys, just loaded vb 2005 onto my PC to start a project for a local club. Basically they wish to record times that a competitor crosses the line. Each competitor will have enough time in between them to allow the user to enter competitor number. I have created a text box for the user to enter rider number, a timer that updates with current system time, and when user clicks button it records the rider number and time the button was clicked. Nice and simple. But, whats the best way to allow this for 100 competitors, for the programme to record each one on a separate line. The data will also need saving, but Im not that far yet so really just looking for guidence on where to go from just 1 single input to infinte inputs. Many thanks in advance

      0 Offline
      0 Offline
      0x3c0
      wrote on last edited by
      #2

      Probably a little overkill, but I would put the button, timer, textbox into a custom control which derives from Panel. Then I would loop from zero to the number of required inputs, adding an instance of this control to a FlowLayoutPanel each time you increment. That saves you the trouble of having to muck about with locations, sizes, etcetera. The other advantage is that when you use a custom control, you only have to make a change to the code in that control, and have that change almost instantly apply to the instances you add to the FlowLayoutPanel

      1 Reply Last reply
      0
      • M mxrobuk

        Hi Guys, just loaded vb 2005 onto my PC to start a project for a local club. Basically they wish to record times that a competitor crosses the line. Each competitor will have enough time in between them to allow the user to enter competitor number. I have created a text box for the user to enter rider number, a timer that updates with current system time, and when user clicks button it records the rider number and time the button was clicked. Nice and simple. But, whats the best way to allow this for 100 competitors, for the programme to record each one on a separate line. The data will also need saving, but Im not that far yet so really just looking for guidence on where to go from just 1 single input to infinte inputs. Many thanks in advance

        M Offline
        M Offline
        Mycroft Holmes
        wrote on last edited by
        #3

        The logistics seem a little off to me. Sounds like the logging of the record is going to become part of the competition. 100 competitors crowded around a limited number of computers waiting to finish sounds, well, wrong. Think about using barcode or RFID scanners, these achieve the sames as typing the details but faster. You are right, you are going to need a database to store the data, use SQL express or Access (under duress). There are plenty of examples of data access here on CP.

        Never underestimate the power of human stupidity RAH

        T 1 Reply Last reply
        0
        • M Mycroft Holmes

          The logistics seem a little off to me. Sounds like the logging of the record is going to become part of the competition. 100 competitors crowded around a limited number of computers waiting to finish sounds, well, wrong. Think about using barcode or RFID scanners, these achieve the sames as typing the details but faster. You are right, you are going to need a database to store the data, use SQL express or Access (under duress). There are plenty of examples of data access here on CP.

          Never underestimate the power of human stupidity RAH

          T Offline
          T Offline
          TheMrProgrammer
          wrote on last edited by
          #4

          i suggest using vb2008 instead of vb2005 as vb2008 is much better allowing better control and many other things

          TheMrProgrammer

          M Z 2 Replies Last reply
          0
          • T TheMrProgrammer

            i suggest using vb2008 instead of vb2005 as vb2008 is much better allowing better control and many other things

            TheMrProgrammer

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            Reply to the OP - I use C#

            Never underestimate the power of human stupidity RAH

            1 Reply Last reply
            0
            • T TheMrProgrammer

              i suggest using vb2008 instead of vb2005 as vb2008 is much better allowing better control and many other things

              TheMrProgrammer

              Z Offline
              Z Offline
              Zaegra
              wrote on last edited by
              #6

              Depends on what you're used to.. ;)

              Motivation is the key to software development.

              1 Reply Last reply
              0
              • M mxrobuk

                Hi Guys, just loaded vb 2005 onto my PC to start a project for a local club. Basically they wish to record times that a competitor crosses the line. Each competitor will have enough time in between them to allow the user to enter competitor number. I have created a text box for the user to enter rider number, a timer that updates with current system time, and when user clicks button it records the rider number and time the button was clicked. Nice and simple. But, whats the best way to allow this for 100 competitors, for the programme to record each one on a separate line. The data will also need saving, but Im not that far yet so really just looking for guidence on where to go from just 1 single input to infinte inputs. Many thanks in advance

                L Offline
                L Offline
                LCARS x32
                wrote on last edited by
                #7

                Wow. Those were really useful posts... Way to help out. BTW: VB.NET can do ANYTHING that C# can do. Anything. :mad: The easiest way to do what you want is with a collection. I would also get rid of the timer and just use Now.timeOfDay to get the current time. Heres an example: The example below needs the following controls on it's form:

                Control Name

                TextBox txtID
                Button btnAdd
                Button btnSave
                ListBox lstResults

                'Begin Code:
                '============================================================================================================
                Option Explicit On
                Option Strict On

                Public Class Form1

                'Create a new structure to make saving our data easy.
                Private Structure Competitor
                    Dim ID As String
                    Dim FinishTime As DateTime
                End Structure
                
                'Create a collection to hold all of the competitors.
                'I like using collections instead of arrays because 
                'they're easy to resize
                Dim myCompetitors As New Collection
                
                Private Sub btnAdd\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
                
                    'Create a competitor variable to temporarily hold the
                    'competitor we are adding.
                    Dim currentCompetitor As New Competitor
                
                    'Set their ID to the the text of the textbox
                    currentCompetitor.ID = txtID.Text
                    'Set the finish time to the current date/time
                    currentCompetitor.FinishTime = Now
                
                    'Add the competitor to the collection
                    myCompetitors.Add(currentCompetitor)
                
                    'Update the list of competitors/times
                    UpdateResults()
                
                    'Reset the textbox and give it focus 
                    'so we don't have to click on anything
                    'to enter the next competitor.
                    txtID.Text = ""
                    txtID.Focus()
                
                End Sub
                
                Private Sub UpdateResults()
                    'This sub updates the listbox with all of 
                    'the competitors in the collection.
                
                    'Clear the contents of the listbox
                    lstResults.Items.Clear()
                
                    'Loop through the collection, adding the competitors information
                    'to the listbox.
                    For Each currentCompetitor As Competitor In myCompetitors
                
                        'add the competitor's ID followed by the date and time of their finish.
                        'if you want to show just their time, you would 
                        'change currentCompetitor.FinishTime.ToString to cur
                
                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups