Click here to Skip to main content
16,006,594 members
Home / Discussions / C#
   

C#

 
GeneralRe: Listing ODBC sources in a drop-down list box Pin
Heath Stewart22-Nov-03 4:53
protectorHeath Stewart22-Nov-03 4:53 
GeneralRe: Listing ODBC sources in a drop-down list box Pin
NikV22-Nov-03 12:49
NikV22-Nov-03 12:49 
GeneralRe: Listing ODBC sources in a drop-down list box Pin
Heath Stewart24-Nov-03 3:49
protectorHeath Stewart24-Nov-03 3:49 
GeneralRe: Listing ODBC sources in a drop-down list box Pin
Nick Parker23-Nov-03 3:22
protectorNick Parker23-Nov-03 3:22 
GeneralRe: Listing ODBC sources in a drop-down list box Pin
Nik Vogiatzis23-Nov-03 11:28
Nik Vogiatzis23-Nov-03 11:28 
GeneralCustomizing buttons Pin
rul30321-Nov-03 13:57
rul30321-Nov-03 13:57 
GeneralRe: Customizing buttons Pin
A.Wegierski21-Nov-03 17:54
A.Wegierski21-Nov-03 17:54 
GeneralRe: Customizing buttons Pin
Heath Stewart22-Nov-03 4:46
protectorHeath Stewart22-Nov-03 4:46 
On top of what A.Wegierski said above, you could get the effect of having only one selected by adding a property, say Group that is a string or a collection object. If it's a string, and when one of these controls is clicked, enumerate the Parent.Controls property like so:
protected override OnClick(EventArgs e)
{
  if (this.Parent == null) return;
  foreach (Control c in this.Parent.Controls)
    if (c is RadioLabel && ((RadioLabel)c).Group == this.Group)
      // Easy-to-property like RadioButtons have, and also draws or remove
      // the border like A.Wegierski mentioned (if you did it that way).
      ((RadioLabel)c).Selected = c == this;
}
If you used a collection object (tip, implement IComponent as well to use it easily in the designer (or create a nifty designer to do this)), the object could add itself to the collection when the collection was assigned. When clicked, you run a similar routine as above but you don't have to worry about getting the parent's Controls collection or checking the group name - your collection already has the right controls:
public GroupCollection Group
{
  get { return this.group; }
  set
  {
    // Remove this control from the group, even if null is assigned
    // (easy way to remove a RadioLabel (or whatever) from its group).
    if (this.group != null) this.group.Remove(this);
    // Assign the group and, if not null, add this control to it.
    this.group = value;
    if (this.group != null) this.group.Add(this);
  }
}


 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
QuestionHow to access command prompt Pin
Anonymous21-Nov-03 10:17
Anonymous21-Nov-03 10:17 
AnswerRe: How to access command prompt Pin
obelisk2921-Nov-03 10:35
obelisk2921-Nov-03 10:35 
GeneralWıindows does not shut down! Heelp! Pin
Utku KAYA21-Nov-03 9:00
Utku KAYA21-Nov-03 9:00 
GeneralRe: Wıindows does not shut down! Heelp! Pin
Daniel M. Edwards21-Nov-03 13:13
Daniel M. Edwards21-Nov-03 13:13 
GeneralRe: Wıindows does not shut down! Heelp! Pin
JJF00721-Nov-03 14:24
JJF00721-Nov-03 14:24 
QuestionHow can a service programatically kill itself Pin
Darryl Borden21-Nov-03 6:18
Darryl Borden21-Nov-03 6:18 
AnswerRe: How can a service programatically kill itself Pin
Darryl Borden21-Nov-03 6:48
Darryl Borden21-Nov-03 6:48 
GeneralGrabbing an tab page from a tab control Pin
RB@Emphasys21-Nov-03 4:09
RB@Emphasys21-Nov-03 4:09 
GeneralRe: Grabbing an tab page from a tab control Pin
Heath Stewart21-Nov-03 4:42
protectorHeath Stewart21-Nov-03 4:42 
GeneralRe: Grabbing an tab page from a tab control Pin
RB@Emphasys21-Nov-03 5:29
RB@Emphasys21-Nov-03 5:29 
GeneralRe: Grabbing an tab page from a tab control Pin
Judah Gabriel Himango21-Nov-03 4:45
sponsorJudah Gabriel Himango21-Nov-03 4:45 
GeneralRe: Grabbing an tab page from a tab control Pin
Heath Stewart21-Nov-03 5:37
protectorHeath Stewart21-Nov-03 5:37 
GeneralHowto create a extra Taskbar for a small battery bar Pin
maZeX21-Nov-03 3:27
maZeX21-Nov-03 3:27 
GeneralRe: Howto create a extra Taskbar for a small battery bar Pin
Heath Stewart21-Nov-03 4:26
protectorHeath Stewart21-Nov-03 4:26 
Generalto get the character which mouse pointer focus on Pin
katoya21-Nov-03 3:16
katoya21-Nov-03 3:16 
GeneralHelp with FolderBrowserDialog... Pin
Søren Christensen21-Nov-03 3:16
Søren Christensen21-Nov-03 3:16 
GeneralRe: Help with FolderBrowserDialog... Pin
Heath Stewart21-Nov-03 4:15
protectorHeath Stewart21-Nov-03 4:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.