|
I think both of these guys are doing the same thing. My take on what they were doing was storing storing a bunch of name/value pairs in a database (they call them "properties"), then expecting the PropertyGrid to show those records. This, obviously, won't work in a straight forward manner by pointing the SelectedObject of the PG at the DataTable object. You'll get the properties of the table, not the data in it.
Are you saying you would either create a custom class deriving from CustomTypeDescriptor or modifying an existing class, implementing ICustomTypeDescriptor, to wrap these name/value pairs as a PropertyDescriptorCollection?? Wouldn't you also have to extend the schema of the datatable to include, at a minimum, type information for each "property"??
|
|
|
|
|
Hello Dave,
There is not a lot of detailed informations in the original post. So I gave a generic advice since the OP seems to ignore that the PropertyGrid can display something else than the simple sum of the public properties in a target instance. How he will get the data in his business objects and how he knows their type is beyond my knowledge of his application.
|
|
|
|
|
I'm just guessing at their applications too.
But, any time I come up with, for example, a settings class, it usually involves a serializable class full of properties, custom types, editors, and maybe a little custom serialization code, then wrapping a UI around it, customized for that class and/or a little more generic, like using a PropertyGrid.
As you probably know, adding new properties to a class like that results in "some" extra work and versioning issues. What I'm curious about is making that process more generic, where I could get away with, say, dumping a bunch of settings name/values into a database or other collection, along with the respective type information, and exposing it to a PropertyGrid through a ICustomTypeDescriptor implementation.
Hmmm...
|
|
|
|
|
If it is for end user (versus a quick and dirty object property view for developers), property grid is not a good control for it. Probably that's why it's not included in the toolbox by default.
You can add an attribute Browsable (System.ComponentModel.BrowsableAttribute)to true or false but I don't think you can change it dynamically.
|
|
|
|
|
The Microsoft PropertyGrid, in the way it is available to the developer, is not really suitable for the end-user. It's not flexible enough and does not offer enough customization options. But a PropertyGrid in itself, is really suitable in so many cases... If it's done well, it can do the job better than any other control. I have written a paper some time ago showcasing a lot of examples in the industry: Why use a PropertyGrid in your application?
|
|
|
|
|
Hi all,
Can we able to populate a property grid using a A datatabel
For example, Like this
PropertyGrid1.SelectedObject=Datatable1
or some any other method exist
Thanks in Advance
Dana
|
|
|
|
|
A property grid simply doesn't work that way. You can't give it a bunch of database rows and expect it to display them.
A PropertyGrid control shows you the public properties of an object, like an instance of a TextBox, Label, DataGridView, ...
It does NOT show the rows of a database table. For that, you'd need to use a DataGridView, or some other bindable grid control.
|
|
|
|
|
Hi Dana,
You can put whatever you want in a PropertyGrid as long as you write a class that will publish the properties you want. It has to implement ICustomTypeDescriptor. If you drop it to the SelectedObject property, you will see the custom properties. With .Net 2.0 you can also use the TypeDescriptionProvider so that you don't have to modify your existing class (the DataTable) to make it implement ICustomTypeDescriptor. You will find some resources about this subject on the PropertyGrid Resource List.
If a commercial component is an option for you, you have also Smart PropertyGrid. It has a mode where you can simply call AppendProperty-like methods and fill the grid completely dynamicall without having to build separate TypeDescriptor classes.
I hope this helps.
|
|
|
|
|
Hi Nicolas,
Thanks for your reply
Can u please brief about this one
With .Net 2.0 you can also use the TypeDescriptionProvider so that you don't have to modify your existing class (the DataTable) to make it implement ICustomTypeDescriptor
Thanks to Dave also
Dana
|
|
|
|
|
|
My requirement
when I go to homepage and I enter username and password.
If it right,
popup dialog will be appears. In popup, three is a tree view.
I click data in tree view. it go to next page .
homepage and popup still open then i have 3 window
And I have some problem follow this
- I want to close homepage and popup page when i click data link in tree view.
how should i do?
Preaw
|
|
|
|
|
The best way to do this is to write your pages as controls, and populate them all on the one form, then you can show/hide controls and only ever have one form visible. The other option is to have the login popup as a child, and then get rid of that, and maintain your main form after that ( I assume the login form is a different size ). Also, you can close any form by calling it's Close() method.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
How to parse VBA script file in MFC ?
I want the following information from the VBA macro file,
1. Number of modules in the script.
2. Name of all the modules.
3. All the function names in the given modules.
Is there any scripting engine ?
Any help would be appreciated.
Thanks and Regards,
Paresh.
|
|
|
|
|
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
i have a report generating system of some employees.when they r using the punching card their details will be stored in the database according to their id number.the report will be stored in some folder.after some timeperiod(we can set the time) the report should automatically send to the outbox of the employee's email id.(as we have stored employee's e mail id coresponding to his emp id.)
what is the code for this?pls explain the logic also.
"I am burning...the only thing rest in me is you..."
|
|
|
|
|
State your question clearly. Are you asking how to send an e-mail using VB.NET?
|
|
|
|
|
i am asking how to send e mail(a text file attachment stored in the system) using vb,there we can set the time to send.
"I am burning...the only thing rest in me is you..."
|
|
|
|
|
This is how I send e-mails using Gmail[^] (the code is in C#, but I guess you'll work it out).
MailMessage has Attachments[^] property, so there should be no problem to attach a file.
accessred wrote: there we can set the time to send
I think that you should use a timer in your application to send e-mail periodically.
|
|
|
|
|
|
will this automatically attach the report while sending?
anyway thanks very mch 4 ur help.
"I am burning...the only thing rest in me is you..."
|
|
|
|
|
Dim s As New System.Web.Mail.MailAttachment("Insert path to file here in form of a string")
.Attachments.Add(s)
--> adding a attachment to the message
If my help was helpfull let me know, if not let me know why.
The only way we learn is by making mistakes.
|
|
|
|
|
thanks very mch.. i 'll update u the result.
"I am burning...the only thing rest in me is you..."
|
|
|
|
|
In VBA environment I have 2 Tabs Inv and Att. When I click on Checkbox in Inv and then click on the next tab which is Att and go back to Inv tab from Att the CheckBoxes in the Inv tab disappear.
So, my question is what should I change in the settings inorder for CheckBoxes in the Inv tab not to disappear?? I tried Hide Selection as False and tried MultiSelect as true but it does not work.
|
|
|
|
|
You have two tabs in what?? Access, Excel, Word, something else??? Is this a tab control?? What are these checkboxes sitting on??
There are no settings to change. There is something your code is doing to cause this or you're expecting functionality that isn't there by default.
|
|
|
|
|
I built a database driven application, when i tried to publish this by building my own setup project and what not, when i install and run the program i get errors saying it can't link to the database etc. Does anyone know why or, what's the proper procedure for publishing database driven apps, do i need to include the database in the setup file?
|
|
|
|