473,586 Members | 2,702 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Propertygrid

Hi

Ho to use dropdown in propertygrid with values from database?

Lets say i have table ITEMS
and columns ID, NAME

Now i want to select id, name from items
and display those values in dropdown of my propertygrid
Best regards;

Mex
Oct 9 '07 #1
3 5184
hi,
below is a useful link

http://www.codeproject.com/csharp/dr...properties.asp
cheers !

Husam Al-A'araj
www.aaraj.net

"Redivivus" wrote:
Hi

Ho to use dropdown in propertygrid with values from database?

Lets say i have table ITEMS
and columns ID, NAME

Now i want to select id, name from items
and display those values in dropdown of my propertygrid
Best regards;

Mex
Oct 9 '07 #2
Mex
Ok i know now hot to use simple combobox in propertygrid
(see code below)
but how to add items with value
Mother=1,Sister =2
and when user select item from combobox i get valuemember not displaymember?
Mex
public class FamilyMember : Component
{

private string relation = "Unknown";

[TypeConverter(t ypeof(RelationC onverter)),Cate gory("Details")]
public string Relation
{
get { return relation; }
set { this.relation = value; }
}
}

internal class RelationConvert er : StringConverter
{

private static StandardValuesC ollection defaultRelation s =
new StandardValuesC ollection(
new string[]{"Mother", "Father", "Sister",
"Brother", "Daughter", "Son",
"Aunt", "Uncle", "Cousin"});
public override bool GetStandardValu esSupported(
ITypeDescriptor Context context)
{
return true;
}

public override bool GetStandardValu esExclusive(
ITypeDescriptor Context context)
{
// returning false here means the property will
// have a drop down and a value that can be manually
// entered.
return true;
}

public override StandardValuesC ollection GetStandardValu es(
ITypeDescriptor Context context)
{
return defaultRelation s;
}
}

"Redivivus" <me***********@ deltmar.eekirju tas sõnumis news:
Oc************* *@TK2MSFTNGP02. phx.gbl...
Hi

Ho to use dropdown in propertygrid with values from database?

Lets say i have table ITEMS
and columns ID, NAME

Now i want to select id, name from items
and display those values in dropdown of my propertygrid
Best regards;

Mex
Oct 10 '07 #3
Hello Mex,

instead of using strings in your standard values, use objects that
store an integer but whose TypeConverter returns the string you want
for the integer. This is what my previously mentioned article
explains.

Best regards,

Nicolas Cadilhac @ VisualHint (http://www.visualhint.com)
Home of Smart FieldPackEditor .Net / DateTimePicker replacement (http://
www.visualhint.com/index.php/fieldpackeditor)
Home of Smart PropertyGrid for .Net and MFC (http://www.visualhint.com/
index.php/propertygrid)
Microsoft PropertyGrid Resource List - http://www.propertygridresourcelist.com

On Oct 10, 8:47 am, "Mex" <redivi...@hot. eewrote:
Ok i know now hot to use simple combobox inpropertygrid
(see code below)
but how to add items with value
Mother=1,Sister =2
and when user select item from combobox i get valuemember not displaymember?

Mex

public class FamilyMember : Component
{

private string relation = "Unknown";

[TypeConverter(t ypeof(RelationC onverter)),Cate gory("Details")]
public string Relation
{
get { return relation; }
set { this.relation = value; }
}
}

internal class RelationConvert er : StringConverter
{

private static StandardValuesC ollection defaultRelation s =
new StandardValuesC ollection(
new string[]{"Mother", "Father", "Sister",
"Brother", "Daughter", "Son",
"Aunt", "Uncle", "Cousin"});

public override bool GetStandardValu esSupported(
ITypeDescriptor Context context)
{
return true;
}

public override bool GetStandardValu esExclusive(
ITypeDescriptor Context context)
{
// returning false here means the property will
// have a drop down and a value that can be manually
// entered.
return true;
}

public override StandardValuesC ollection GetStandardValu es(
ITypeDescriptor Context context)
{
return defaultRelation s;
}
}

"Redivivus" <meelis.lil...@ deltmar.eekirju tas sõnumis news:
OciQFKpCIHA.1.. .@TK2MSFTNGP02. phx.gbl...
Hi
Ho to use dropdown inpropertygridw ith values from database?
Lets say i have table ITEMS
and columns ID, NAME
Now i want to select id, name from items
and display those values in dropdown of mypropertygrid
Best regards;
Mex

Oct 12 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2887
by: Terry | last post by:
I have a very basic program, but for some reason I can't get it to behave properly. What I want is a basic form with a TabControl that fills the entire form. The tab control should have 4 tabs with a single PropertyGrid control on each tab that fills it's parent's tab page's client area. Here's what I did. 1. Create a new project.
3
6039
by: Dave Girvitz | last post by:
I have a PropertyGrid (Windows Forms App) based component that uses TypeConverters to generate ranges of acceptable values for properties. The idea was that I could download the key/value pairs from a database and manipulate the TypeConverters dynamically. The property grid then displays the property with a drop down list. It does work...
1
11865
by: ANDRES BECERRA | last post by:
Herfried K. Wagner was kind enough to point me to the PropertyGrid control http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwindowsformspropertygridclasstopic.asp I have found a few samples of how to use the PropertyGrid control and have gained a decent understanding of it. But of course, as it usually the case, my needs go far...
1
2561
by: Lance | last post by:
Is there any way to tell a Windows.Forms.PropertyGrid to update the values for the properties that it is displaying? I am having trouble getting the PropertyGrid to update when I make changes to the SelectedObject's properties outside of the PropertyGrid. If I use the PropertyGrid to change the SelectedObject's properties then everything...
7
9703
by: siddhiash | last post by:
Hi Friends I want to add PasswordChar Property which shows ****** for string which I type in PropertyGrid Control. Regards, Siddharth
4
3068
by: Bernie Yaeger | last post by:
How can I set the browsableattributes of the control that has been selected (selectedobject) by the propertygrid? Here's what I'm after - I want to open a form with a propertygrid in it. The selectedobject will be the form itself. I want the user to change certain properties, thus changing the form. This works fine, but what I really want...
6
6927
by: Steve Teeples | last post by:
Can someone show me an example of how to place a "CheckedListBox" property within a PropertyGrid? -- ----------- Thanks, Steve
5
15325
by: Sharon | last post by:
I'm using the PropertyGrid control, and I want it to show a button. But I set the PropertyGrid.SelectedObject with a object that as a Button property, the PropertyGrid shows the buttons properties, and I want the button to be shown as drawn and clickable button. How can I do that? -- Thanks Sharon
4
18812
by: phcmi | last post by:
I have a PropertyGrid question. My task is to replace a legacy dialog box presentation with a modern one. The dialog itself allows the user to set configuration settings in our application, so it seems to me that a PropertyGrid is a perfect modern replacement. I won't bore you with the details with all the controls on the dialog since I'm...
3
4329
by: =?Utf-8?B?U3RldmVU?= | last post by:
Is it possible to hide a row within a PropertyGrid based upon the boolean value of another row within the PropertyGrid? I am using VS2005 with .NET Frameworks 2.0. -- ----------- Thanks, Steve
0
7911
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7839
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8338
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7954
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5390
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3836
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1448
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1179
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.