|
-
Apr 19th, 2008, 09:33 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] C#/VS2005 - How can I pass a listbox and it's selected index?
I want to pass the selected index to a method. I have several listbox's and I want to figure out how I can pass that particular listbox's selected index to a method and then return some result. Not sure if I want it to just be a boolean or a number. I am thinking a boolean value would suffice.
checkDialsPosition(listbox1.SelectedIndex);
private void checkDialsPosition(chckthis listbox)
{
if (chckthis.SelectedIndex == 1)
{
if (dialPosition > 34 & dialPosition < 72)
{
pictureBox1.BackColor = Color.Green;
return true;
}
else { pictureBox1.BackColor = Color.Red;
return false;
}
}
}
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
|