vb dot net help

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Dec 2008
Posts: 14
Reputation: asif786 is an unknown quantity at this point 
Solved Threads: 0
asif786 asif786 is offline Offline
Newbie Poster

vb dot net help

 
0
  #1
Dec 28th, 2008
i am using vb dot net. i want to store multiple values in a variable and then check whether any of the values held in the variable match what the user inputs. Please help i can not code it , i tried but failed.

This is not homework just a practice task so that i am able to code in vb dot net

could you please elaborate on answers as i do not how i would use arrays in this way thanks

i couldn't do it with arrays so tried with if statements and variable si know it doesn't work but just did it, to show you guys that i tried .

here is my code:

[ code] If voter number = voternumcheck Then
MsgBox("Please choose how you will like your voting to take place by clicking the appropriate button")
btnvotes.Enabled = True
btnpercentage.Enabled = True
Else code]
Thanks
Attached Files
File Type: zip My Code.rar.zip (34.0 KB, 2 views)
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: vb dot net help

 
0
  #2
Dec 28th, 2008
Go to google.com search on "array in VB.NET"
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 710
Reputation: Teme64 will become famous soon enough Teme64 will become famous soon enough 
Solved Threads: 114
Teme64's Avatar
Teme64 Teme64 is offline Offline
Master Poster

Re: vb dot net help

 
0
  #3
Dec 29th, 2008
Here's a sample how to work with arrays
  1. Private VoteArray() As Integer ' Array for items (integers in this case)
  2. Private Const VOTE_ARRY_SIZE As Integer = 3 ' Number of items in the array
  3. ' A help variable to hold "voted number"
  4. Private Voted As Integer
  5.  
  6. Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
  7. '
  8. ' Set array size. Notice: arrays are zero-based
  9. ReDim VoteArray(VOTE_ARRY_SIZE - 1)
  10. ' If you have continuous values, use a loop to fill the array
  11. VoteArray(0) = 2
  12. VoteArray(1) = 3
  13. VoteArray(2) = 4
  14.  
  15. End Sub
  16.  
  17. Private Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
  18. '
  19. ' Notice: Voted value is now hard coded, you'll use textbox or something like that
  20. Voted = 2
  21. If [Array].IndexOf(VoteArray, Voted) >= 0 Then
  22. MessageBox.Show("Found", "Vote", MessageBoxButtons.OK, MessageBoxIcon.Information)
  23. Else
  24. MessageBox.Show("Not found", "Vote", MessageBoxButtons.OK, MessageBoxIcon.Information)
  25. End If
  26.  
  27. End Sub
Suggested reading: Array Class in MSDN
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC