Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
DotNet
acad.assignment.mngr
academic
adonet
aspnet
aspnet.announcements
aspnet.build.controls
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
clr
compactframework
component_services
datatools
distributed_apps
drawing
faqs
framework
framework.wmi
general
internationalization
interop
languages.csharp
languages.jscript
languages.vb
languages.vb.controls
languages.vb.data
languages.vb.upgrade
languages.vc
languages.vc.libraries
myservices
odbcnet
performance
remoting
scripting
sdk
security
setup
vjsharp
vsa
webservi.enhancements
webservices
windowsforms
windowsforms.controls
winforms.databinding
winforms.designtime
xml
  
 
date: Thu, 17 Jul 2008 12:32:10 -0700,    group: microsoft.public.dotnet.languages.csharp        back       


Is there a limit on # of radio buttons   
I have 8 radio buttons on my Windows form but I can only select up to the 
first 4.  If I click on any button beyond the 4th one and then come back into 
the program again the 4th button is always checked instead of the 5th or 6th 
etc.  I followed the logic thru the debugger and can see where the 5th button 
is progammatically checked but the window shows the 4th checked instead.  
Does anyone have a clue as to what's going on here?  All of the radio buttons 
are in a group box.
Dave
date: Thu, 17 Jul 2008 12:32:10 -0700   author:   Parrot

Re: Is there a limit on # of radio buttons   
Parrot wrote:
> I have 8 radio buttons on my Windows form but I can only select up to the 
> first 4.  If I click on any button beyond the 4th one and then come back into 
> the program again the 4th button is always checked instead of the 5th or 6th 
> etc.  I followed the logic thru the debugger and can see where the 5th button 
> is progammatically checked but the window shows the 4th checked instead.  
> Does anyone have a clue as to what's going on here?  All of the radio buttons 
> are in a group box.
> Dave

If there is a limit, it's certainly not four. Rather something like 
65536 or 4294967296.

Where are you storing the data? Have you checked if the stored value is 
correct or not?

How do you make the right radio button selected when you load the data?

-- 
Göran Andersson
_____
http://www.guffa.com
date: Thu, 17 Jul 2008 23:13:49 +0200   author:   Göran Andersson

Re: Is there a limit on # of radio buttons   
The logic I am using is very simple.  When loading the program I check a 
passed variable.  The code goes like this:

if(dateformat.Compare("month") ==0)
{
    radioButton5.Checked = true;
 }

However, when the window is displayed, it shows radioButton4 checked 
instead.  I followed the logic in debug mode and that is the only radiobutton 
programmatically checked.  I don't understand how something so simple cannot 
work.
Dave 

"Göran Andersson" wrote:

> Parrot wrote:
> > I have 8 radio buttons on my Windows form but I can only select up to the 
> > first 4.  If I click on any button beyond the 4th one and then come back into 
> > the program again the 4th button is always checked instead of the 5th or 6th 
> > etc.  I followed the logic thru the debugger and can see where the 5th button 
> > is progammatically checked but the window shows the 4th checked instead.  
> > Does anyone have a clue as to what's going on here?  All of the radio buttons 
> > are in a group box.
> > Dave
> 
> If there is a limit, it's certainly not four. Rather something like 
> 65536 or 4294967296.
> 
> Where are you storing the data? Have you checked if the stored value is 
> correct or not?
> 
> How do you make the right radio button selected when you load the data?
> 
> -- 
> Göran Andersson
> _____
> http://www.guffa.com
>
date: Thu, 17 Jul 2008 15:09:03 -0700   author:   Parrot

Re: Is there a limit on # of radio buttons   
"Parrot"  wrote in message 
news:AAD2D073-6FDA-4251-B276-0A889627F63B@microsoft.com...
>
> However, when the window is displayed, it shows radioButton4 checked
> instead.  I followed the logic in debug mode and that is the only 
> radiobutton
> programmatically checked.  I don't understand how something so simple 
> cannot
> work.
> Dave

VB6 dev here, so dotNet Radio buttons may've changed (but I doubt it, since 
they were the same in VB3/NT3.51 as they are in VB6/XP).. They're not as 
easy to work with as they seem.

Since they change to "True" when they get focus, no matter what, you have to 
make sure of a few things before hiding/showing/disabling/enabling them. The 
simplest method I've seen (and used extensively) is to disable their 
container until focus is where you'd like it to be.

For example... if Button3's currently = True, but when your form shows (or 
you're enabling/disabling controls), the first control that gains focus is 
Button5, Button5 will be set = True, no matter what. So, disabling the 
container forces focus elsewhere, which prevents this problem... since my 
apps control hardware and are used in the cleanroom, we don't allow focus to 
"stick" to a control that may cause something to move... too many people can 
walk up and lean on the keyboard, etc.... so, I usually drop a picturebox on 
the form, set its background = form's background and set focus to that. 
Since the picturebox doesn't show a focus rectangle, and there's no code in 
its click event, people can lean on the keyboard all they want without 
worry.

In your case, maybe you have a textbox or command button to set focus to, 
instead.... what ever the case, you'll probably find your "rouge radio 
button" that keeps setting itself = true is getting focus without your 
involvement..
date: Thu, 17 Jul 2008 15:43:41 -0700   author:   Ken Halter

Re: Is there a limit on # of radio buttons   
This is really crazy.  The only way I can keep radiobutton4 from being 
checked even though radiobutton5 is checked is to disable radiobutton4.  
However, then if radiobutton6 is checked then the check mark goes to 
radiobutton5, the one above it.  If I disable radiobutton5 when checking 
radiobutton6 the check mark will go back to radiobutton4.  I removed and 
re-added the radiobuttons but to no avail. I still get the same problem.  
Simply put. the system will not properly handle beyond 3 radio buttons in the 
same group.  Such a simple program and I am spinning my wheels.  It couldn't 
be a bug could it?
Dave

"Ken Halter" wrote:

> "Parrot"  wrote in message 
> news:AAD2D073-6FDA-4251-B276-0A889627F63B@microsoft.com...
> >
> > However, when the window is displayed, it shows radioButton4 checked
> > instead.  I followed the logic in debug mode and that is the only 
> > radiobutton
> > programmatically checked.  I don't understand how something so simple 
> > cannot
> > work.
> > Dave
> 
> VB6 dev here, so dotNet Radio buttons may've changed (but I doubt it, since 
> they were the same in VB3/NT3.51 as they are in VB6/XP).. They're not as 
> easy to work with as they seem.
> 
> Since they change to "True" when they get focus, no matter what, you have to 
> make sure of a few things before hiding/showing/disabling/enabling them. The 
> simplest method I've seen (and used extensively) is to disable their 
> container until focus is where you'd like it to be.
> 
> For example... if Button3's currently = True, but when your form shows (or 
> you're enabling/disabling controls), the first control that gains focus is 
> Button5, Button5 will be set = True, no matter what. So, disabling the 
> container forces focus elsewhere, which prevents this problem... since my 
> apps control hardware and are used in the cleanroom, we don't allow focus to 
> "stick" to a control that may cause something to move... too many people can 
> walk up and lean on the keyboard, etc.... so, I usually drop a picturebox on 
> the form, set its background = form's background and set focus to that. 
> Since the picturebox doesn't show a focus rectangle, and there's no code in 
> its click event, people can lean on the keyboard all they want without 
> worry.
> 
> In your case, maybe you have a textbox or command button to set focus to, 
> instead.... what ever the case, you'll probably find your "rouge radio 
> button" that keeps setting itself = true is getting focus without your 
> involvement..
>  
> 
> 
>
date: Thu, 17 Jul 2008 18:26:02 -0700   author:   Parrot

Re: Is there a limit on # of radio buttons   
On Thu, 17 Jul 2008 18:26:02 -0700, Parrot  
 wrote:

> [...]
> Simply put. the system will not properly handle beyond 3 radio buttons  
> in the
> same group.  Such a simple program and I am spinning my wheels.  It  
> couldn't
> be a bug could it?

Surely it's a bug.  But it's probably in your code.

Unfortunately, you haven't shared that with us.  So it's not possible for  
us to point it out.

If you can post a concise-but-complete code sample that reliably  
reproduces the problem, it should be possible to provide a more complete  
answer.

Pete
date: Thu, 17 Jul 2008 19:36:32 -0700   author:   Peter Duniho

Re: Is there a limit on # of radio buttons   
I am pasting the entire code for the C# program below.  As I mentioned 
earlier I can follow the logic in debug mode and I can see where radiobutton5 
is set to checked but it still shows radiobutton4 with the check  when the 
window is displayed.

namespace WindowsApplication1
{
    public partial class convertdate : Form
    {

        public string xdateformat;

        public convertdate(string field, string dateformat)
        {
            InitializeComponent();
            label2.Text = field;

             xdateformat = dateformat;

            if (dateformat.CompareTo("1") == 0)
                radioButton1.Checked = true;
            else
                if (dateformat.CompareTo("101") == 0)
                {
                    radioButton2.Checked = true;
                    radioButton1.Checked = false;
                }
                else
            if (dateformat.CompareTo("107") == 0)
               {
                    radioButton3.Checked = true;
                    radioButton1.Checked = false;
                }
                else
                    if (dateformat.CompareTo("year") == 0)
                    {
                        radioButton4.Checked = true;
                        radioButton1.Checked = false;
                    }
                    else
                        if (dateformat.CompareTo("month") == 0)
                        {
                            radioButton5.Checked = true;
                            radioButton1.Checked = false;
                            
                        }
                        else
                            if (dateformat.CompareTo("day") == 0)
                            {
                                radioButton6.Checked = true;
                                radioButton1.Checked = false;
                                 
                            }
                            else
                                if (dateformat.CompareTo("monthname") == 0)
                                {
                                    radioButton7.Checked = true;
                                    radioButton1.Checked = false;
                                }
                                else
                                    if (dateformat.CompareTo("dayname") == 0)
                                    {
                                        radioButton8.Checked = true;
                                        radioButton1.Checked = false;
                                    }
            
        }

        private void OnCancel(object sender, EventArgs e)
        {
            this.Close();
        }

        private void OnOk(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
                xdateformat = "1";
            else
                if (radioButton2.Checked)
                    xdateformat = "101";
                else
                    if (radioButton3.Checked)
                        xdateformat = "107";
                    else
                        if (radioButton4.Checked)
                            xdateformat = "year";
                        else
                            if (radioButton5.Checked)
                                xdateformat = "month";
                            else
                                if (radioButton6.Checked)
                                    xdateformat = "day";
                                else
                                    if (radioButton7.Checked)
                                        xdateformat = "monthname";
                                    else
                                        if (radioButton8.Checked)
                                            xdateformat = "dayname";
            this.Close();
        }
    }
}

"Peter Duniho" wrote:

> On Thu, 17 Jul 2008 18:26:02 -0700, Parrot  
>  wrote:
> 
> > [...]
> > Simply put. the system will not properly handle beyond 3 radio buttons  
> > in the
> > same group.  Such a simple program and I am spinning my wheels.  It  
> > couldn't
> > be a bug could it?
> 
> Surely it's a bug.  But it's probably in your code.
> 
> Unfortunately, you haven't shared that with us.  So it's not possible for  
> us to point it out.
> 
> If you can post a concise-but-complete code sample that reliably  
> reproduces the problem, it should be possible to provide a more complete  
> answer.
> 
> Pete
>
date: Thu, 17 Jul 2008 20:58:02 -0700   author:   Parrot

Re: Is there a limit on # of radio buttons   
On Thu, 17 Jul 2008 20:58:02 -0700, Parrot  
 wrote:

> I am pasting the entire code for the C# program below.

That wasn't a complete code sample.

Also, as a minor suggestion for making your code more pleasant for others  
to read: when writing "if/else if/else" statements, it's customary to  
avoid excessive indentation by writing "else if" on the same line, and  
indenting each "else if" and the final "else" the same amount as the  
initial "if".

Pete
date: Thu, 17 Jul 2008 22:00:59 -0700   author:   Peter Duniho

Re: Is there a limit on # of radio buttons   
"Parrot"  wrote in message 
news:269F7D69-4014-4756-93BC-F4F528BE8711@microsoft.com...
>I am pasting the entire code for the C# program below.  As I mentioned
> earlier I can follow the logic in debug mode and I can see where 
> radiobutton5
> is set to checked but it still shows radiobutton4 with the check  when the
> window is displayed.
>
> namespace WindowsApplication1
> {
>    public partial class convertdate : Form
>    {
>
>        public string xdateformat;
>
>        public convertdate(string field, string dateformat)
>        {
>            InitializeComponent();
>            label2.Text = field;
>
>             xdateformat = dateformat;
>
>            if (dateformat.CompareTo("1") == 0)
>                radioButton1.Checked = true;
>            else
>                if (dateformat.CompareTo("101") == 0)
>                {
>                    radioButton2.Checked = true;
>                    radioButton1.Checked = false;
>                }
>                else
>            if (dateformat.CompareTo("107") == 0)
>               {
>                    radioButton3.Checked = true;
>                    radioButton1.Checked = false;
>                }
>                else
>                    if (dateformat.CompareTo("year") == 0)
>                    {
>                        radioButton4.Checked = true;
>                        radioButton1.Checked = false;
>                    }
>                    else
>                        if (dateformat.CompareTo("month") == 0)
>                        {
>                            radioButton5.Checked = true;
>                            radioButton1.Checked = false;
>
>                        }
>                        else
>                            if (dateformat.CompareTo("day") == 0)
>                            {
>                                radioButton6.Checked = true;
>                                radioButton1.Checked = false;
>
>                            }
>                            else
>                                if (dateformat.CompareTo("monthname") == 0)
>                                {
>                                    radioButton7.Checked = true;
>                                    radioButton1.Checked = false;
>                                }
>                                else
>                                    if (dateformat.CompareTo("dayname") == 
> 0)
>                                    {
>                                        radioButton8.Checked = true;
>                                        radioButton1.Checked = false;
>                                    }
>
>        }
>
>        private void OnCancel(object sender, EventArgs e)
>        {
>            this.Close();
>        }
>
>        private void OnOk(object sender, EventArgs e)
>        {
>            if (radioButton1.Checked)
>                xdateformat = "1";
>            else
>                if (radioButton2.Checked)
>                    xdateformat = "101";
>                else
>                    if (radioButton3.Checked)
>                        xdateformat = "107";
>                    else
>                        if (radioButton4.Checked)
>                            xdateformat = "year";
>                        else
>                            if (radioButton5.Checked)
>                                xdateformat = "month";
>                            else
>                                if (radioButton6.Checked)
>                                    xdateformat = "day";
>                                else
>                                    if (radioButton7.Checked)
>                                        xdateformat = "monthname";
>                                    else
>                                        if (radioButton8.Checked)
>                                            xdateformat = "dayname";
>            this.Close();
>        }
>    }
> }
>
> "Peter Duniho" wrote:
>
>> On Thu, 17 Jul 2008 18:26:02 -0700, Parrot
>>  wrote:
>>
>> > [...]
>> > Simply put. the system will not properly handle beyond 3 radio buttons
>> > in the
>> > same group.  Such a simple program and I am spinning my wheels.  It
>> > couldn't
>> > be a bug could it?
>>
>> Surely it's a bug.  But it's probably in your code.
>>
>> Unfortunately, you haven't shared that with us.  So it's not possible for
>> us to point it out.
>>
>> If you can post a concise-but-complete code sample that reliably
>> reproduces the problem, it should be possible to provide a more complete
>> answer.
>>
>> Pete
>>
>

We need the code behind the form.  That's where the grouping of radio 
buttons is controlled.  You have a grouping error.

Mike.
date: Fri, 18 Jul 2008 05:40:33 -0600   author:   Michael D. Ober obermd.@.alum.mit.edu.nospam.

Re: Is there a limit on # of radio buttons   
On Jul 17, 9:58 pm, Parrot  wrote:
> I am pasting the entire code for the C# program below.  As I mentioned
> earlier I can follow the logic in debug mode and I can see where radiobutton5
> is set to checked but it still shows radiobutton4 with the check  when the
> window is displayed.
>

There's nothing wrong with your code, specifically, I pasted it into
an application
and it worked fine. The problem is probably in what you do with the
xdateformat
variable after the form closes. Can you show the code that calls this
form?

matt
date: Fri, 18 Jul 2008 06:36:13 -0700 (PDT)   author:   Matt

Re: Is there a limit on # of radio buttons   
Here is the form code.  I noticed that there are some buttons in between the 
radio buttons.  Perhaps, that is what is causing the problem.  Anyhow, I 
deleted the group box and re-added the radio buttons and now it is working 
properly.  I don't know how it became faulty in the first place.  I still 
think there is a bug somewhere that caused it to become screwed up because I 
designed this window in the same manner as all others using Visual Studio 
2005.  I did not override any behind the scene code.  Thanks to everyone who 
replied to this problem.  If anyone knows what is faulty about the code 
below, please let me know as I normally don't look at the behind the form 
code.
Dave


        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.radioButton3 = new System.Windows.Forms.RadioButton();
            this.radioButton2 = new System.Windows.Forms.RadioButton();
            this.radioButton1 = new System.Windows.Forms.RadioButton();
            this.button1 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.radioButton4 = new System.Windows.Forms.RadioButton();
            this.radioButton5 = new System.Windows.Forms.RadioButton();
            this.radioButton6 = new System.Windows.Forms.RadioButton();
            this.radioButton7 = new System.Windows.Forms.RadioButton();
            this.radioButton8 = new System.Windows.Forms.RadioButton();
            this.groupBox1.SuspendLayout();
            this.SuspendLayout();
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Font = new System.Drawing.Font("Microsoft Sans 
Serif", 12.25F, System.Drawing.FontStyle.Bold, 
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label1.ForeColor = System.Drawing.Color.Navy;
            this.label1.Location = new System.Drawing.Point(64, 9);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(178, 20);
            this.label1.TabIndex = 0;
            this.label1.Text = "Date Conversion for";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Font = new System.Drawing.Font("Microsoft Sans 
Serif", 12.25F, System.Drawing.FontStyle.Bold, 
System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.label2.ForeColor = System.Drawing.Color.Navy;
            this.label2.Location = new System.Drawing.Point(68, 46);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(59, 20);
            this.label2.TabIndex = 1;
            this.label2.Text = "label2";
            // 
            // groupBox1
            // 
            this.groupBox1.Controls.Add(this.radioButton8);
            this.groupBox1.Controls.Add(this.radioButton7);
            this.groupBox1.Controls.Add(this.radioButton6);
            this.groupBox1.Controls.Add(this.radioButton5);
            this.groupBox1.Controls.Add(this.radioButton4);
            this.groupBox1.Controls.Add(this.radioButton3);
            this.groupBox1.Controls.Add(this.radioButton2);
            this.groupBox1.Controls.Add(this.radioButton1);
            this.groupBox1.Location = new System.Drawing.Point(58, 69);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(200, 217);
            this.groupBox1.TabIndex = 2;
            this.groupBox1.TabStop = false;
            this.groupBox1.Text = "Date display options";
            // 
            // radioButton3
            // 
            this.radioButton3.AutoSize = true;
            this.radioButton3.Location = new System.Drawing.Point(18, 68);
            this.radioButton3.Name = "radioButton3";
            this.radioButton3.Size = new System.Drawing.Size(96, 17);
            this.radioButton3.TabIndex = 2;
            this.radioButton3.Text = "Month dd, yyyy";
            this.radioButton3.UseVisualStyleBackColor = true;
            // 
            // radioButton2
            // 
            this.radioButton2.AutoSize = true;
            this.radioButton2.Location = new System.Drawing.Point(18, 44);
            this.radioButton2.Name = "radioButton2";
            this.radioButton2.Size = new System.Drawing.Size(83, 17);
            this.radioButton2.TabIndex = 1;
            this.radioButton2.Text = "mm/dd/yyyy";
            this.radioButton2.UseVisualStyleBackColor = true;
            // 
            // radioButton1
            // 
            this.radioButton1.AutoSize = true;
            this.radioButton1.Checked = true;
            this.radioButton1.Location = new System.Drawing.Point(18, 20);
            this.radioButton1.Name = "radioButton1";
            this.radioButton1.Size = new System.Drawing.Size(73, 17);
            this.radioButton1.TabIndex = 0;
            this.radioButton1.TabStop = true;
            this.radioButton1.Text = "mm/dd/yy";
            this.radioButton1.UseVisualStyleBackColor = true;
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(68, 293);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(75, 23);
            this.button1.TabIndex = 3;
            this.button1.Text = "Ok";
            this.button1.UseVisualStyleBackColor = true;
            this.button1.Click += new System.EventHandler(this.OnOk);
            // 
            // button2
            // 
            this.button2.Location = new System.Drawing.Point(171, 292);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(75, 23);
            this.button2.TabIndex = 4;
            this.button2.Text = "Cancel";
            this.button2.UseVisualStyleBackColor = true;
            this.button2.Click += new System.EventHandler(this.OnCancel);
            // 
            // radioButton4
            // 
            this.radioButton4.AutoSize = true;
            this.radioButton4.Location = new System.Drawing.Point(18, 92);
            this.radioButton4.Name = "radioButton4";
            this.radioButton4.Size = new System.Drawing.Size(47, 17);
            this.radioButton4.TabIndex = 8;
            this.radioButton4.TabStop = true;
            this.radioButton4.Text = "Year";
            this.radioButton4.UseVisualStyleBackColor = true;
            // 
            // radioButton5
            // 
            this.radioButton5.AutoSize = true;
            this.radioButton5.Location = new System.Drawing.Point(18, 116);
            this.radioButton5.Name = "radioButton5";
            this.radioButton5.Size = new System.Drawing.Size(55, 17);
            this.radioButton5.TabIndex = 9;
            this.radioButton5.TabStop = true;
            this.radioButton5.Text = "Month";
            this.radioButton5.UseVisualStyleBackColor = true;
            // 
            // radioButton6
            // 
            this.radioButton6.AutoSize = true;
            this.radioButton6.Location = new System.Drawing.Point(18, 141);
            this.radioButton6.Name = "radioButton6";
            this.radioButton6.Size = new System.Drawing.Size(44, 17);
            this.radioButton6.TabIndex = 10;
            this.radioButton6.TabStop = true;
            this.radioButton6.Text = "Day";
            this.radioButton6.UseVisualStyleBackColor = true;
            // 
            // radioButton7
            // 
            this.radioButton7.AutoSize = true;
            this.radioButton7.Location = new System.Drawing.Point(18, 165);
            this.radioButton7.Name = "radioButton7";
            this.radioButton7.Size = new System.Drawing.Size(84, 17);
            this.radioButton7.TabIndex = 11;
            this.radioButton7.TabStop = true;
            this.radioButton7.Text = "Month name";
            this.radioButton7.UseVisualStyleBackColor = true;
            // 
            // radioButton8
            // 
            this.radioButton8.AutoSize = true;
            this.radioButton8.Location = new System.Drawing.Point(18, 189);
            this.radioButton8.Name = "radioButton8";
            this.radioButton8.Size = new System.Drawing.Size(73, 17);
            this.radioButton8.TabIndex = 12;
            this.radioButton8.TabStop = true;
            this.radioButton8.Text = "Day name";
            this.radioButton8.UseVisualStyleBackColor = true;
            // 
            // convertdate
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 328);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Name = "convertdate";
            this.Text = "convertdate";
            this.groupBox1.ResumeLayout(false);
            this.groupBox1.PerformLayout();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.RadioButton radioButton3;
        private System.Windows.Forms.RadioButton radioButton2;
        private System.Windows.Forms.RadioButton radioButton1;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.RadioButton radioButton4;
        private System.Windows.Forms.RadioButton radioButton8;
        private System.Windows.Forms.RadioButton radioButton7;
        private System.Windows.Forms.RadioButton radioButton6;
        private System.Windows.Forms.RadioButton radioButton5;

Dave

"Michael D. Ober" wrote:

> "Parrot"  wrote in message 
> news:269F7D69-4014-4756-93BC-F4F528BE8711@microsoft.com...
> >I am pasting the entire code for the C# program below.  As I mentioned
> > earlier I can follow the logic in debug mode and I can see where 
> > radiobutton5
> > is set to checked but it still shows radiobutton4 with the check  when the
> > window is displayed.
> >
> > namespace WindowsApplication1
> > {
> >    public partial class convertdate : Form
> >    {
> >
> >        public string xdateformat;
> >
> >        public convertdate(string field, string dateformat)
> >        {
> >            InitializeComponent();
> >            label2.Text = field;
> >
> >             xdateformat = dateformat;
> >
> >            if (dateformat.CompareTo("1") == 0)
> >                radioButton1.Checked = true;
> >            else
> >                if (dateformat.CompareTo("101") == 0)
> >                {
> >                    radioButton2.Checked = true;
> >                    radioButton1.Checked = false;
> >                }
> >                else
> >            if (dateformat.CompareTo("107") == 0)
> >               {
> >                    radioButton3.Checked = true;
> >                    radioButton1.Checked = false;
> >                }
> >                else
> >                    if (dateformat.CompareTo("year") == 0)
> >                    {
> >                        radioButton4.Checked = true;
> >                        radioButton1.Checked = false;
> >                    }
> >                    else
> >                        if (dateformat.CompareTo("month") == 0)
> >                        {
> >                            radioButton5.Checked = true;
> >                            radioButton1.Checked = false;
> >
> >                        }
> >                        else
> >                            if (dateformat.CompareTo("day") == 0)
> >                            {
> >                                radioButton6.Checked = true;
> >                                radioButton1.Checked = false;
> >
> >                            }
> >                            else
> >                                if (dateformat.CompareTo("monthname") == 0)
> >                                {
> >                                    radioButton7.Checked = true;
> >                                    radioButton1.Checked = false;
> >                                }
> >                                else
> >                                    if (dateformat.CompareTo("dayname") == 
> > 0)
> >                                    {
> >                                        radioButton8.Checked = true;
> >                                        radioButton1.Checked = false;
> >                                    }
> >
> >        }
> >
> >        private void OnCancel(object sender, EventArgs e)
> >        {
> >            this.Close();
> >        }
> >
> >        private void OnOk(object sender, EventArgs e)
> >        {
> >            if (radioButton1.Checked)
> >                xdateformat = "1";
> >            else
> >                if (radioButton2.Checked)
> >                    xdateformat = "101";
> >                else
> >                    if (radioButton3.Checked)
> >                        xdateformat = "107";
> >                    else
> >                        if (radioButton4.Checked)
> >                            xdateformat = "year";
> >                        else
> >                            if (radioButton5.Checked)
> >                                xdateformat = "month";
> >                            else
> >                                if (radioButton6.Checked)
> >                                    xdateformat = "day";
> >                                else
> >                                    if (radioButton7.Checked)
> >                                        xdateformat = "monthname";
> >                                    else
> >                                        if (radioButton8.Checked)
> >                                            xdateformat = "dayname";
> >            this.Close();
> >        }
> >    }
> > }
> >
> > "Peter Duniho" wrote:
> >
> >> On Thu, 17 Jul 2008 18:26:02 -0700, Parrot
> >>  wrote:
> >>
> >> > [...]
> >> > Simply put. the system will not properly handle beyond 3 radio buttons
> >> > in the
> >> > same group.  Such a simple program and I am spinning my wheels.  It
> >> > couldn't
> >> > be a bug could it?
> >>
> >> Surely it's a bug.  But it's probably in your code.
> >>
> >> Unfortunately, you haven't shared that with us.  So it's not possible for
> >> us to point it out.
> >>
> >> If you can post a concise-but-complete code sample that reliably
> >> reproduces the problem, it should be possible to provide a more complete
> >> answer.
> >>
> >> Pete
> >>
> >
> 
> We need the code behind the form.  That's where the grouping of radio 
> buttons is controlled.  You have a grouping error.
> 
> Mike.
> 
> 
>
date: Fri, 18 Jul 2008 08:38:00 -0700   author:   Parrot

Re: Is there a limit on # of radio buttons   
On Fri, 18 Jul 2008 08:38:00 -0700, Parrot  
 wrote:

> [...] If anyone knows what is faulty about the code
> below, please let me know as I normally don't look at the behind the form
> code.

I don't see anything obviously wrong, but then I didn't bother to try to  
run it either.  The only slightly incongruous thing is that the TabStop  
properties for your RadioButton instances are not contiguous.  It's  
possible that the RadioButton cycling code depends on them being  
contiguous, though I have to say I've never noticed that limitation before.

The "some buttons in between the radio buttons" doesn't matter, because  
the only are "in between" in terms of the order of execution of their  
instantiation.  The buttons aren't actually in the GroupBox, nor does it  
appears to me that any of their initialization affects any of the  
initialization of the RadioButton instances or the GroupBox itself.

Basically, I didn't see anything in the Designer code you posted that I  
think the Designer _shouldn't_ be able to generate, given specific user  
input.  But I can't say for sure whether it's simply that the user input  
was wrong, or the Designer incorrectly interpreted the user input.

Pete
date: Fri, 18 Jul 2008 09:40:23 -0700   author:   Peter Duniho

Re: Is there a limit on # of radio buttons   
I don't really know what caused the problem either but I will remember to 
just delete and re-add a group box the next time the problem occurs.
Dave

"Peter Duniho" wrote:

> On Fri, 18 Jul 2008 08:38:00 -0700, Parrot  
>  wrote:
> 
> > [...] If anyone knows what is faulty about the code
> > below, please let me know as I normally don't look at the behind the form
> > code.
> 
> I don't see anything obviously wrong, but then I didn't bother to try to  
> run it either.  The only slightly incongruous thing is that the TabStop  
> properties for your RadioButton instances are not contiguous.  It's  
> possible that the RadioButton cycling code depends on them being  
> contiguous, though I have to say I've never noticed that limitation before.
> 
> The "some buttons in between the radio buttons" doesn't matter, because  
> the only are "in between" in terms of the order of execution of their  
> instantiation.  The buttons aren't actually in the GroupBox, nor does it  
> appears to me that any of their initialization affects any of the  
> initialization of the RadioButton instances or the GroupBox itself.
> 
> Basically, I didn't see anything in the Designer code you posted that I  
> think the Designer _shouldn't_ be able to generate, given specific user  
> input.  But I can't say for sure whether it's simply that the user input  
> was wrong, or the Designer incorrectly interpreted the user input.
> 
> Pete
>
date: Fri, 18 Jul 2008 11:05:03 -0700   author:   Parrot

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us