TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Svetlyo Baltadjiev
NA
8
813
Need help with listbox
Mar 17 2020 1:36 PM
I am pretty new to programming and I need help. I have a listbox with names and when radioButtonA is selected I need all of the names which are on an even numbered row to be copied to a textbox. When radioButton B is selected, the names on odd numbered rows should be copied in the textbox instead. However I do not know how to put the number of rows in a constant which I need. I also do not know how to copy the specific names to the textbox. The code is below.
private void button1_Click(object sender, EventArgs e)
{
String group = "?????";
listBox1 //I want to get the number of names in the listbox on this line
int size = //I want to put the number of names from the listbox in this int constant
if (radioButtonA.Checked == true)
{
group += "A:\n\n";
for (int i = 0; i < size; i += 2)
{
group += + "\n"; //I want to add the name from the row in here
}
textBox2.Text = group;
}
else if (radioButtonB.Checked == true)
{
group += "B:\n\n";
for (int i = 1; i<size; i+= 2)
{
group += + "\n"; //I want to add the name from the row in here
}
textBox2.Text = group;
}
}
Reply
Answers (
2
)
How to change dd/mm/yyyy date formate of excel to dd-mm-yyyy
how to build fingerprint scanner for windows form for login