Effective Displays

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an application that reads columns of information from a database, based upon a specific key.

What I am trying to do is to create an input form for this, which is where I have a problem. I have written handlers for the different types of information to be stored in the database, so that an image will produce an image, and a string will be a string...

I would like some sort of datagrid that allows you to have a different handler for each row (similar to the property grid in VS.net) Some will be textboxes, some will be pictureboxes.

Is there a simple way around doing this?

Thanks

Martin
 
Hi martin,

Thank you for posting in the community! My name is Jeffrey, and I will be
assisting you on this issue.

Is your datagrid WinForm based or Web Form based? I suppose you want to do
in Windows Form.
Based on my understanding, you want to implement different columns in the
datagrid for different data types.
============================================================
In WinForm, DataGrid uses different column style to display data.
There are 2 already made concrete column styles: DataGridBoolColumn and
DataGridTextBoxColumn. These 2 column styles both inherited from
DataGridColumnStyle abstract class.

You can create your own datagrid column style for your data source. You
need to override some of the DataGridColumnStyle's class and do your
customized operations(Such as paint, etc)

Please refer to the article below to find a sample:
http://www.codeproject.com/cs/miscctrl/DataGridZen.asp?target=datagrid|col
umn

Also, there is a sample code in MSDN document of DataGridColumnStyle class,
please refer to:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemwindowsformsdatagridcolumnstyleclasstopic.asp

===========================================================
Please apply my suggestion above and let me know if it helps resolve your
problem.

Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.
Have a nice day!!

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Didn't think of doing it that way!

Would it be possible though, to rotate the datagrid around on the form, so that the columns become rows, and rows become columns? I have instances where there will be a single row with many columns, and it would make more sense to display it that way round.

Thanks

Martin
 
Hi Martin,

Thanks very much for your feedback.

I am glad my reply makes sense to you.

For your further concern, in windows form, there is no way for DataGrid
control to rotate display. Because its each column must be the same data
type.

If you have few rows of data, you can just use some simple controls(such as
textbox, picturebox, label) on the form(In vertical alignment), and
databind to certain field of database.

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Hi Martin,

Congratulations!

If you have any further concern, please feel free to post, I will work with
you, :-)

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top