+ Post New Thread
Results 1 to 10 of 10
Coding Thread, Radio buttons in a sort of 'grid' in c# in Coding and Web Development; I am trying to rustle up a grid of radiobuttons in c# which will work in both horizontal and vertical ...
  1. #1

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,881
    Thank Post
    518
    Thanked 2,486 Times in 1,928 Posts
    Blog Entries
    24
    Rep Power
    838

    Radio buttons in a sort of 'grid' in c#

    I am trying to rustle up a grid of radiobuttons in c# which will work in both horizontal and vertical groups.

    So, if a person chooses one of the radiobuttons in a row, it will work like normal with the rest of that row.

    However, I then want all the other rows to disable the ability to use the radio button in that column from being chosen.

    Is there an easy-ish way of doing this?

  2. #2
    Jamo's Avatar
    Join Date
    Jan 2009
    Posts
    1,354
    Thank Post
    66
    Thanked 175 Times in 147 Posts
    Rep Power
    60
    Is this a kind of multiple choice style exercise?

    I suppose you could arrange the radio buttons in rows then upon a selection of a button disable the others in that particular column?

  3. #3

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,881
    Thank Post
    518
    Thanked 2,486 Times in 1,928 Posts
    Blog Entries
    24
    Rep Power
    838
    Quote Originally Posted by Jamo View Post
    Is this a kind of multiple choice style exercise?

    I suppose you could arrange the radio buttons in rows then upon a selection of a button disable the others in that particular column?
    The other thing is, the number of columns/rows will be determined dynamically from the import of data. So, if the data has 10 different columns, there will be 10 rows, and 10 columns (well, 11, as 'not in heirachy' will be one too).

    Its for dynamically importing people into the active directory, creating OUs based on the options in the radio buttons etc... So, if 'year' is a column, and 'reg group', then year could be selected as the top most OU to group by, then reg group etc... with any which aren't OUs left as 'not in heirachy' to be used to assign values to new user objects.

  4. #4

    ZeroHour's Avatar
    Join Date
    Dec 2005
    Location
    Edinburgh, Scotland
    Posts
    5,627
    Thank Post
    920
    Thanked 1,336 Times in 816 Posts
    Blog Entries
    1
    Rep Power
    448
    Time to try out the new tables feature of CKEditor (in advanced posting)

    Is this kind of what you mean?
    {radio selected} {radio enabled} {radio enabled}
    {radio} {radio disabled} {radio disabled}
    {radio} {radio disabled} {radio disabled}

    Trying to visualise it.

  5. #5
    Jamo's Avatar
    Join Date
    Jan 2009
    Posts
    1,354
    Thank Post
    66
    Thanked 175 Times in 147 Posts
    Rep Power
    60
    It is difficult to visualise what you need, could the same be accomplished with a listbox with tickboxes enabled?

  6. #6

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,881
    Thank Post
    518
    Thanked 2,486 Times in 1,928 Posts
    Blog Entries
    24
    Rep Power
    838
    Quote Originally Posted by ZeroHour View Post
    {radio selected} {radio} {radio}
    {radio} {radio selected} {radio}
    {radio} {radio} {radio selected}
    Like that, so no column can have 2 enabled, and no row can have 2 enabled.

    And @Jamo - no I couldn't. As a listbox wouldn't be able to have both multi-columns and checkboxes etc...

  7. #7

    LosOjos's Avatar
    Join Date
    Dec 2009
    Location
    West Midlands
    Posts
    5,500
    Thank Post
    1,456
    Thanked 1,201 Times in 814 Posts
    Rep Power
    713
    I'm just trying to imagine this off the top of my head so no code, but could you use the 'Tag' property of each radio button to store it's row and colum ID's (simple CSV format), and also store each radio button object in an array upon creation, then create a sub routine which upon update of the radio button's state, cycles through the array checking for any in the same column/row and disabling them if they're enabled, possibly returning a message to the end user if a clashing button is found to be currently selected?

    EDIT: alternatively, you could use a multi-dimensional array to store each object, it's row number and it's column number rather than the 'Tag' property, would probably be more efficient
    Last edited by LosOjos; 14th June 2011 at 03:28 PM.

  8. #8
    Jamo's Avatar
    Join Date
    Jan 2009
    Posts
    1,354
    Thank Post
    66
    Thanked 175 Times in 147 Posts
    Rep Power
    60
    Quote Originally Posted by localzuk View Post
    Like that, so no column can have 2 enabled, and no row can have 2 enabled.

    And @Jamo - no I couldn't. As a listbox wouldn't be able to have both multi-columns and checkboxes etc...
    Sorry I think I misinterpreted your original requirements somewhat!

    I have certainly not heard of an automated control which can be used in this form, I would think that a Radiobuton would be too restrictive with its automatic grouping functions and that a tickbox with custom actions assigned to it would be the simplest solution to the problem.

    I would agree with @Los0jos that an multidim array of boolean values created on form creation (or import of the data) would be simplest and then on click of the controls do a manual iteration through the array values to ensure that the conditions are met for the tickbox to be enabled.

  9. #9

    localzuk's Avatar
    Join Date
    Dec 2006
    Location
    Minehead
    Posts
    17,881
    Thank Post
    518
    Thanked 2,486 Times in 1,928 Posts
    Blog Entries
    24
    Rep Power
    838
    I think Los0jos and yourself are correct here - doing it all manually looks to be the best bet.

  10. #10

    Join Date
    Jan 2006
    Location
    Surburbia
    Posts
    2,178
    Thank Post
    74
    Thanked 307 Times in 243 Posts
    Rep Power
    115
    Does it have to be a radio button? Any kind of table thingy makes me think of DataGridViews which are ever so handy at times and they support a CheckBox type.

SHARE:
+ Post New Thread

Similar Threads

  1. Remove Next and Prev Buttons?
    By aaron_au in forum EduGeek Joomla 1.5 Package
    Replies: 5
    Last Post: 14th October 2010, 11:41 AM
  2. Two buttons please
    By SimpleSi in forum Comments and Suggestions
    Replies: 1
    Last Post: 5th February 2010, 09:07 AM
  3. Mouse Buttons GP
    By karldenton in forum Windows
    Replies: 4
    Last Post: 14th January 2010, 11:05 AM
  4. Keyboard buttons
    By majeeko in forum How do you do....it?
    Replies: 7
    Last Post: 1st October 2008, 12:01 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •