tags:

views:

184

answers:

3

My winforms application will display 100 different names, and I will need the user to enter a number 1 through 4 next to each name. I will then store this data.

I know I can use the spreadsheet control, but is there something much simpler that I can use?

Maybe an array of textboxes or a datagrid?

+2  A: 

I would recommend using a DataGrid. This will scale much better than an array of TextBoxes, and should do exactly what you need.

Reed Copsey
does datagrid accept user input?
I__
i dont think i get the user input from datagrid
I__
@Alex - yes, you can get the user input from a datagrid. You need to provide an EditTemplate for any columns in which you want the user to be able to interact.
Rob Allen
+2  A: 

Why not use a numeric up/down control (spinner)?

Something like this would work well:

http://visualbasic.about.com/od/usingvbnet/l/aa082103a.htm

You can embed this in a custom field in a datagrid or repeater if necessary.
You can also just use a combobox:

http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.aspx

Depending on what you are using this for, you might also be able to use something like this:

http://www.codeproject.com/KB/miscctrl/cs_star_rating_control.aspx

Then the user can just click the value.

With either of these options at least your user wont have to enter a value manually and you can set bounds in the control instead of having to validate their input. Your last option should be the user entering a number into a textbox really.

Geoffrey Chetwood
+3  A: 

You should be able to use a datagrid and have the first column contain a textbox Item and have a second column display a name. you should also be able to use a listview the same way. Although to be honest you might want a drop down box put in the gridview instead of a text box because with a dropdown/combo box you can make sure they input only a 1-4 because that will be there only options

Bryan
Yah, -1 for giving a completely correct and acceptable way to do it (of course with no input on why i was givin -1). Good for you to whoever bashed my answer for no reason.
Bryan
With the time it looks like you spent on this answer, I am in awe at the amount of ego you are exhibiting for you to think that someone should devote their time to commenting about their downvote.
Geoffrey Chetwood
@Rich B you really need to get off your high-horse and stop harassing me. I'm tired of it and i wouldn't be supprised to learn that you've been the one searching through all of my posts and downvoting them. Just because i didn't have the software with me to add code doesn't mean my answer is incorrect. I also can't help but notice that for at least half of your answer you just copied my answer and added links.
Bryan
@Bryan: Nice try. Revision history shows my revisions came before yours.
Geoffrey Chetwood