| | |
vb .net array loop?
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2008
Posts: 14
Reputation:
Solved Threads: 0
I am coding a program which will simulate a ballot box, where voting wil take place. The code generates a random number which is the voter number which is unique to each voter. This is output to the user before voting. I would like it to perform a check to see if the voter number has been used before or not. i will do this by asking the voter to input there voter number and then perform the check. Please help. Thanks a lot i know i have to use a loop to go through each number and see if it matches or not. But i dont know how to store the voter number as the program will have to be able to store anywhere between 2 and 5000.
VB.NET Syntax (Toggle Plain Text)
' /* Declare A New Stack Object */ Dim usedIDs As New Stack ' /* Assume User Enters VoterID In Textbox1 */ if usedIDs.Contains(textbox1.text) then ' /* Voter Number Has Not Been Used Yet So... */ ' /* Add Item To Stack */ usedIDs.Push(textbox1.text) ' /* Keep Doing Stuff For Valid Voter ID */ else messagebox.show("This Voter ID Is Already Used... Get Your Own!") end if
Oops, I just realized that my code is wrong in the if statement. It should be:
Sorry for that.
VB.NET Syntax (Toggle Plain Text)
if usedIDs.Contains(textbox1.text) then ' /* ID Has Been Used! */ messagebox.show("This Voter ID Is Already Used.... Get Your Own!") else usedIDs.Push(textbox1.text) end if
![]() |
Similar Threads
- How to read csv file contents in VB.Net (VB.NET)
- Generate Html from VB.net (ASP.NET)
- VB.NET ComboBox & Statusbar HELP! (VB.NET)
- Going from ASP 3.0 to VB.NET (VB.NET)
- Sorting in date order (Visual Basic 4 / 5 / 6)
- Homework: filling array from text file (VB.NET)
- Saving information from .NET Listbox into SQL Server 2000 (ASP.NET)
- Compare two text feilds (JavaScript / DHTML / AJAX)
- Dynamic Structure with For Loop Help Please (C++)
- Need Help counting Array Length (C++)
Other Threads in the VB.NET Forum
- Previous Thread: Visual Basic 2008 and Access 2003 - Cant manage to search, can someone help ?
- Next Thread: custom openfile dialog box
| Thread Tools | Search this Thread |
.net .net2005 30minutes 2005 2008 access account arithmetic array basic binary bing button buttons c# center check code combobox component connectionstring convert crystalreport data database databasesearch datagrid datagridview design dissertation dissertations dissertationthesis dropdownlist excel file-dialog folder ftp generatetags google gridview hardcopy image images inline insert intel internet listview mobile monitor ms net networking output passingparameters peertopeervideostreaming picturebox picturebox1 plugin port print problem problemwithinstallation project reports" save savedialog searchbox searchvb.net select serial server soap sql string table tcp text textbox timer toolbox trim update updown user usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web wpf






