Newbie looking for direction
-
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
-
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
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
-
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
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
-
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
i suggest using vb2008 instead of vb2005 as vb2008 is much better allowing better control and many other things
TheMrProgrammer
-
i suggest using vb2008 instead of vb2005 as vb2008 is much better allowing better control and many other things
TheMrProgrammer
Reply to the OP - I use C#
Never underestimate the power of human stupidity RAH
-
i suggest using vb2008 instead of vb2005 as vb2008 is much better allowing better control and many other things
TheMrProgrammer
-
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
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 OnPublic 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