.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> Windows Application >> Post New QuestionBookmark and Share Subscribe to Forum

Dynamic Properties in C#,net

Posted By: Narayanan     Posted Date: July 18, 2011    Points:5   Category :Windows Application
Hi ,
I am looking for Dynamic Properties in C#.net in Windows application.One flowLayoutpanel in the form.Dynamic properties are Group box ,Picture Boxes and Labels In that flowLayoutPanel.My question is when i click the One Picture Box ,Label text should change and another picture box picture should change .please help me How to do this task ?.





Responses
Author: Dhiraj Ranka             
Posted Date: July 20, 2011     Points: 20   
Author: Narayanan             
Posted Date: July 22, 2011     Points: 20   

Hi,
Thanks for your link . I will try .
Regards
Lakshmi Narayanan.S

Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
Author: Sasi Prabhu             
Posted Date: July 29, 2011     Points: 20   
Author: Gowthammanju             
Posted Date: July 29, 2011     Points: 20   

to create dynamic property here is the coding as

as directory

Dictionary<string,object> properties; 


code as

using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApplication1 {

class ObjectWithProperties {
Dictionary<string, object> properties = new Dictionary<string,object>();

public object this[string name] {
get {
if (properties.ContainsKey(name)){
return properties[name];
}
return null;
}
set {
properties[name] = value;
}
}

}

class Comparer<T> : IComparer<ObjectWithProperties> where T : IComparable {

string m_attributeName;

public Comparer(string attributeName){
m_attributeName = attributeName;
}

public int Compare(ObjectWithProperties x, ObjectWithProperties y) {
return ((T)x[m_attributeName]).CompareTo((T)y[m_attributeName]);
}

}

class Program {

static void Main(string[] args) {

// create some objects and fill a list
var obj1 = new ObjectWithProperties();
obj1["test"] = 100;
var obj2 = new ObjectWithProperties();
obj2["test"] = 200;
var obj3 = new ObjectWithProperties();
obj3["test"] = 150;
var objects = new List<ObjectWithProperties>(new ObjectWithProperties[]{ obj1, obj2, obj3 });

// filtering:
Console.WriteLine("Filtering:");
var filtered = from obj in objects
where (int)obj["test"] >= 150
select obj;
foreach (var obj in filtered){
Console.WriteLine(obj["test"]);
}

// sorting:
Console.WriteLine("Sorting:");
Comparer<int> c = new Comparer<int>("test");
objects.Sort(c);
foreach (var obj in objects) {
Console.WriteLine(obj["test"]);
}
}

}
}


Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: Narayanan             
Posted Date: January 13, 2012     Points: 20   

Hi,
thanks for your reply

Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend