| | |
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
Views: 3000 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for VB.NET
.net .net2008 2008 access add advanced application array assignment basic beginner box browser button buttons center click client code combo convert cpu cuesent data database datagrid datagridview datetimepicker designer dissertation dissertations dissertationtopic eclipse editvb.net employees excel exists forms function html images isnumericfuntioncall lib listview map mobile module msaccess mssqlbackend mysql net number open page pan pdf picturebox picturebox2 port print printing printpreview problem record regex reuse richtextbox right-to-left save search serial settings socket sorting sqldatbase sqlserver storedprocedure structures temp textbox timer transparency txttoxmlconverter usercontol vb vb.net vb2008 vba vbnet vista visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winsock wpf wrapingcode xml






