[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 190
  • Last Modified:

DataGrids - I give up!

Still learning, so keep that in mind.

I've been reading about DataGrids because I need one in my application.  They make no sense to me.  At all.  None.  Microsoft took something that should be very simple and made it the most incoherent, convoluted thing ever.  And I thought the Swing equal to a DataGrid was bad. :)

Here's all I want to do:

A DataGrid with 3 columns, the last of those columns containing 3 controls (LinkLabels).  I'm generating the DataTable programatically (not from a database, from another source) cause that's the only way this even makes a bit of sense to me.  The columns are readonly, their widths are equal, and they should be sortable by clicking on the heading.  That's all I want to do.  Nearly the simplest thing possible.  My main issue with this whole thing is the designer won't let me bing my DataTable to the DataGrid and it has to be done programatically.  Isn't the point of DataGrids + the forms designer to completely avoid getting into the gory details?

Learning C# and Forms had been a pleasure up until then.  Now I'm just pulling my hair out.

Thanks much for any help regarding this.
0
dbunder
Asked:
dbunder
1 Solution
 
NetworkArchitekCommented:
um ... So what is the problem? Its easy to bind the DataGrid to a DataTable, I don't think I caught what the problem is exactly. You can do this totally through the designer but its like two lines of code if you program it. Maybe I am missing somehting ...
0
 
dbunderAuthor Commented:
What I'm basically asking is how you do it through the designer.  I'm unable to bind anything that way, though I do know how to do it programmatically.  From reading Microsoft's docs, it's supposed to be the easiest thing in the world... I just can't figure out how to do it.  Can't attach styles to the columns through the designer either, which is another thing that's supposedly easy to do from within the designer.

Also wanted to know how to add controls to datagrid cels.  Haven't been able to find much of anything about this.
0
 
fruhjCommented:
Hey Dbunder -

  you right click on the data grid in designer to choose formatting options.

0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
dbunderAuthor Commented:
Is this to apply styles to the datagrid?  All I was able to find was "Auto Formatting" which changes colors and whatnot based on templates.
0
 
Éric MoreauSenior .Net ConsultantCommented:
The DataGrid sucks. Microsoft never gave a full featured grid component (and no real numeric/masked textbox neither). It lets this parts to 3rd party components.

Have a look at this site: http://www.syncfusion.com/FAQ/WindowsForms/FAQ_c44c.aspx
0
 
Bob LearnedCommented:
Micro$oft is just being true to form.  It has never had a good grid control in any version of any product:  C++, VB3/4/5/6, and now VB.NET and C#.

Bob
0
 
NipNFriar_TuckCommented:
Alright... to do what you want through the designed here is what you need to do...

1) Goto the properties for you data grid.
2) Goto the TableStyles property and click in the box.  This will give an ?elips? button (...), which you click on to bring up a dialog.
3) In the dialog you need to set the mapping name to the name of your DataTable.
4) If you want to, you can modify the cloumns by going into the GridColumnStyles.
5) Programatically, assign you data table to the data grid then display.

HTH.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now