Click here to Skip to main content
15,920,468 members
Home / Discussions / C#
   

C#

 
AnswerRe: DataGridView Selections Pin
Andrei Ungureanu8-Oct-07 4:07
Andrei Ungureanu8-Oct-07 4:07 
GeneralRe: DataGridView Selections Pin
ffowler8-Oct-07 4:15
ffowler8-Oct-07 4:15 
GeneralRe: DataGridView Selections Pin
Andrei Ungureanu8-Oct-07 4:22
Andrei Ungureanu8-Oct-07 4:22 
GeneralRe: DataGridView Selections Pin
ffowler8-Oct-07 5:39
ffowler8-Oct-07 5:39 
QuestionReflection Pin
karoitay8-Oct-07 3:49
karoitay8-Oct-07 3:49 
AnswerRe: Reflection Pin
Judah Gabriel Himango8-Oct-07 4:31
sponsorJudah Gabriel Himango8-Oct-07 4:31 
GeneralThanks Pin
karoitay8-Oct-07 5:29
karoitay8-Oct-07 5:29 
AnswerRe: Reflection Pin
Pete O'Hanlon8-Oct-07 4:32
mvePete O'Hanlon8-Oct-07 4:32 
Rather than looking at the class, you have to look at the fields that belong to the class. Try this instead:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Reflection;

namespace Test
{
    [AttributeUsage(AttributeTargets.All)]
    public class myattribute : Attribute
    {
        public myattribute() : base() { }
    }
    public partial class Form1 : Form
    {
        [myattribute]
        Button b1;
        public Form1()
        {
            b1 = new Button();
            this.Controls.Add(b1);
            FieldInfo[] fis = this.GetType().GetFields(
               BindingFlags.Instance | BindingFlags.NonPublic | 
               BindingFlags.Public);
            foreach (FieldInfo fi in fis)
            {
                object[] o = fi.GetCustomAttributes(typeof(myattribute), true);
                if (o.Length != 0)
                {
                    Console.WriteLine("Hello from o");
                }
            }
        }
    }
}


Deja View - the feeling that you've seen this post before.

GeneralRe: Reflection Pin
karoitay8-Oct-07 5:27
karoitay8-Oct-07 5:27 
QuestionDrag and Drop Text Pin
Jinwah508-Oct-07 3:20
Jinwah508-Oct-07 3:20 
AnswerRe: Drag and Drop Text Pin
c#_keithy8-Oct-07 3:23
c#_keithy8-Oct-07 3:23 
QuestionKeyChar reference, does it vary with keyboard? Pin
c#_keithy8-Oct-07 3:13
c#_keithy8-Oct-07 3:13 
AnswerRe: KeyChar reference, does it vary with keyboard? Pin
Andrei Ungureanu8-Oct-07 3:27
Andrei Ungureanu8-Oct-07 3:27 
GeneralRe: KeyChar reference, does it vary with keyboard? Pin
c#_keithy8-Oct-07 3:35
c#_keithy8-Oct-07 3:35 
QuestionHow to determine provider type Pin
jpasher8-Oct-07 2:41
jpasher8-Oct-07 2:41 
QuestionCommunicating with a service Pin
Lars Lie8-Oct-07 2:30
Lars Lie8-Oct-07 2:30 
AnswerRe: Communicating with a service Pin
Judah Gabriel Himango8-Oct-07 4:34
sponsorJudah Gabriel Himango8-Oct-07 4:34 
Questionusing events as arguments Pin
Bekjong8-Oct-07 2:30
Bekjong8-Oct-07 2:30 
AnswerRe: using events as arguments Pin
Pete O'Hanlon8-Oct-07 2:41
mvePete O'Hanlon8-Oct-07 2:41 
GeneralRe: using events as arguments Pin
Bekjong8-Oct-07 3:11
Bekjong8-Oct-07 3:11 
GeneralRe: using events as arguments Pin
Scott Dorman8-Oct-07 3:57
professionalScott Dorman8-Oct-07 3:57 
GeneralRe: using events as arguments Pin
Pete O'Hanlon8-Oct-07 4:00
mvePete O'Hanlon8-Oct-07 4:00 
QuestionWSS 3.0 Config Database Pin
lsconyer8-Oct-07 2:22
lsconyer8-Oct-07 2:22 
Questionhow to read rext file? Pin
P_Elza8-Oct-07 0:52
P_Elza8-Oct-07 0:52 
AnswerRe: how to read rext file? Pin
Andrei Ungureanu8-Oct-07 0:59
Andrei Ungureanu8-Oct-07 0:59 

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.