|
-
Apr 18th, 2005, 05:04 PM
#1
Thread Starter
Member
Small Problem...
A simple problem that i cannontcrack, and its just annoying me. The user must enter a lane number for an athlete
i want it to say:
On button Click
Store Lane in ListBox
Check If Lane already entered
MsgBox("Lane Already Entered")
else store lane
End If
how can i check if it has already been entered? what should the correct coding be
lstLane is the name of lstBox
iLane is Lane Number
do i need a counter?
Cheers
-
Apr 18th, 2005, 05:10 PM
#2
Re: Small Problem...
Maybe add the entered value into an array and then check the array everytime the user goes to enter a new value - alert them if its already there else allow them to continue....
Just an idea 
Cheers,
RyaNJ
-
Apr 18th, 2005, 05:13 PM
#3
Re: Small Problem...
If you have a button for each lane, as you select the lane, just disable the button so that it can't be selected again.
-
Apr 18th, 2005, 05:16 PM
#4
Thread Starter
Member
Re: Small Problem...
How do i store/call from that array though?
Im sorry, still only new to programming and getting the hold of it
should it be something like:
dim iLane(11) as integer
then how do you store and call from the array to check?
Cheers
-
Apr 18th, 2005, 05:16 PM
#5
Re: Small Problem...
 Originally Posted by dglienna
If you have a button for each lane, as you select the lane, just disable the button so that it can't be selected again.
Thats a more interesting way to do it 
Cheers,
RyanJ
-
Apr 18th, 2005, 05:20 PM
#6
Thread Starter
Member
Re: Small Problem...
Yeah but i dont have a button for each lane, and i cant do it like that. The end user must enter the lane and have it validated... im sorry, any ideas on the code???
-
Apr 18th, 2005, 05:22 PM
#7
Re: Small Problem...
You could even have the person's name in the disbled button.
Anyways, what are your button's purpose? What controls are you using besides a button?
-
Apr 18th, 2005, 05:26 PM
#8
Thread Starter
Member
Re: Small Problem...
Basically the user enteres a name, a time the person swum, and the lane the person was in.
When the button is pressed, it stores the values in three seperate listboxes.
All i want it to do, is check if the lane has already been entered into the listbox, and if it has, then display an error message to re-enter lane number.
Does this explain it?
Cheers
-
Apr 18th, 2005, 05:27 PM
#9
Member
Re: Small Problem...
Let me answer this question people! Just a minute though i gotta see if it works.
-
Apr 18th, 2005, 05:38 PM
#10
Thread Starter
Member
Re: Small Problem...
Ok Cheers mate, any solutions???
-
Apr 18th, 2005, 05:40 PM
#11
Member
Re: Small Problem...
GOT IT! Just a minute i should have it in a minute!
-
Apr 18th, 2005, 05:44 PM
#12
Member
Re: Small Problem...
Woot! here you go bud... fresh from the kitchen.
Dim x As String
Dim y As Integer
MsgBox List1.ListCount
For y = 0 To (List1.ListCount - 1)
List1.ListIndex = y
x = List1.Text
MsgBox x
If x = "Grey" Then
MsgBox "beeer"
End If
Next y
-
Apr 18th, 2005, 05:46 PM
#13
Member
Re: Small Problem...
 Originally Posted by littleman001
Woot! here you go bud... fresh from the kitchen.
Dim x As String
Dim y As Integer
MsgBox List1.ListCount
For y = 0 To (List1.ListCount - 1)
List1.ListIndex = y
x = List1.Text
MsgBox x
If x = "Grey" Then
MsgBox "beeer"
End If
Next y
just start a new program up and insert this text into a command button and also insert a list button you should get it from there
-
Apr 18th, 2005, 05:49 PM
#14
Member
Re: Small Problem...
Please let me know if it works or not! common man im waitin
-
Apr 18th, 2005, 06:02 PM
#15
Thread Starter
Member
Re: Small Problem...
When i put it in to a code,
it says ListIndex is not a member of System.Windows.Forms.ListBox
or the same for ListCount
Do i have to declare these somewhere?
I dont understand
-
Apr 18th, 2005, 06:07 PM
#16
Re: Small Problem...
looks like you wandered into the wrong forum by mistake. that looks like 'Net code. this is the vbforum.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|