Co2 Posted June 10, 2003 Posted June 10, 2003 (edited) Why I don't like the datagrid control? Hello everyone, Can you tell me why the datagrid control from the .net framework sucks so much? I must admit that if you want to do some simple things, like the classic master/detail view or just showing a dataset, you're fine but don't go further. Where is my SelectionMode property? How come I cannot easily get a doubleclick event on a cell or on a row? I wanted to create a simple row selection datagrid using the doubleclick event on a row to confirm the selection. I can use this or even this for the row selection but both solution have drawbacks. The first one is graphically ugly and the second one doesn't work well with the readonly property set to true. For the doubleclick event, I could use the solution that works well when I'm not using the row selection code or use my own personal favorite that simulate the doubleclick (using the row selection code): Private LastTicks As Long Private ClickCount As Integer = 0 Private ClickedRow As Integer = -1 Private Sub DataGrid1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles DataGrid1.MouseDown 'TODO: Find the real doubleclick delay ! If e.Button = MouseButtons.Left Then Dim HitInfo As DataGrid.HitTestInfo = DataGrid1.HitTest(e.X, e.Y) If HitInfo.Type = DataGrid.HitTestType.Cell Then If ClickCount = 0 Then ClickCount = 1 LastTicks = DateTime.Now.Ticks ClickedRow = HitInfo.Row ElseIf ClickCount = 1 AndAlso HitInfo.Row = ClickedRow AndAlso (DateTime.Now.Ticks - LastTicks) < 500000 Then Debug.Write("We've got a DoubleClick!") ElseIf ClickCount = 1 Then LastTicks = DateTime.Now.Ticks ClickedRow = HitInfo.Row End If End If End If End Sub Was there someone sleeping at Microsoft when it was time to create the datagrid control or what? Am I oblige to buy one of those really expensive .net controls (here, here, and here) to get basic features from a grid control? Will I have to hack that grid control or build one from scratch ? Edited September 26, 2003 by Robby Quote
Moderators Robby Posted June 10, 2003 Moderators Posted June 10, 2003 You have a couple of choices; build your own or buy one. Either way, your statement "...the datagrid control from the .net framework sucks so much..." is really uncalled for. You seem to have found several solutions, so what exactly are you asking. Quote Visit...Bassic Software
ashrobo Posted June 10, 2003 Posted June 10, 2003 he's probably looking something that's cheap and good. Quote
Co2 Posted June 10, 2003 Author Posted June 10, 2003 Those solutions are not. I cannot create a robust grid with those. Quote
*Experts* jfackler Posted June 10, 2003 *Experts* Posted June 10, 2003 (edited) I suppose this post is representative of the risk inherent in pushing code writing in a visual environment to the point of relative ease that has been achieved. The risk and the benefits of a more structured, coding environment merge as writing apps becomes more accessible to the masses and an appreciation for the complexity inherent in the "creating" of the elements available in which to present our information is lost. It would seem the dissastifaction lies in the desire to have the work of "creating" already completed. "Creating a robust grid" is much different than using a pre-built control. The visual presentation of data is only part of the creative work in a well written app. The visual elements all need to have code written for them to be implemented by our apps. The datagrid is a complex control that does a tremendous amount of that work for us even without customization. The .net controls you can purchase are expensive because they require experience, hours of work and a certain amount of artistry to create. They do not however come preconfigured for your specific implementation without a cost. That cost is the price of good code. And therein lies the risk of making writing apps in a visual environment progressively easier. We lose the ability to write good code and become graphic designers. Edited June 10, 2003 by jfackler Quote
uidgreg Posted July 9, 2003 Posted July 9, 2003 Co2 is right. The DataGrid is difficult to use. And if it's in the Tool Box, there should be no need to customize it. Microsoft should have done that. What happened to RAD - Rapid Application Development? Want proof from a respected author? Check out this link: http://www.devx.com/codemag/Article/11489 Quote
Moderators Robby Posted July 10, 2003 Moderators Posted July 10, 2003 To quote the author... " It is great as long as your needs match one of its built-in features." Well doesn't this hold true for a third party datagrid as well? Quote Visit...Bassic Software
*Experts* jfackler Posted July 10, 2003 *Experts* Posted July 10, 2003 And if it's in the Tool Box, there should be no need to customize it. Microsoft should have done that. What happened to RAD - Rapid Application Development? Being in the Tool Box says nothing about customization. The more complex the control, the more diverse the means of customization. The fact that the Datagrid is complex to customize, simply speaks to the complexity of its underlying code which Microsoft did write for you. What happened to RAD? Try writing a DataGrid class yourself and appreciate the amount of RAD you get from it's un-customized instantiation. This argument simply supports my previous statement, we are becoming graphic designers, wanting someone else to do the base work of writing the underlying code. As graphic designers we blame the developer for the inflexibility of the code they wrote and which we are using without writing a single line. (Kind of arrogant don't you think?) Reminds me of the joke about the engineer and the manager.... Jon Quote
uidgreg Posted July 11, 2003 Posted July 11, 2003 Hi. Concerning the DataGrid ... I just need to format a DataGrid row (i.e. change the text color) based on the value of some cell. I've researched this quite a bit and have only found the following: http://www.codeproject.com/useritems/CustomDataGridsAndDesigne.asp#xx486254xx Does anyone know of a simpler way of doing this? And in VB.NET (rather than C# as given in the example)? For those interested, I received a reply on the Microsoft .NET Framework Windows Forms forum saying that such functionality might be added to the next version of Visual Studio.NET ... http://www.windowsforms.net//Forums/ShowPost.aspx?tabIndex=1&tabId=41&PostID=5556 Thanks Quote
hog Posted July 11, 2003 Posted July 11, 2003 Well all I can say is that a great deal of the stuff available in VS is new to me and as such provides an interesting challenge to learn how to use them for my specific purposes. I only started using DataGrids yesterday and have already learned so much about them which give a warm glow of satisfaction. To be in a position whereby you get angry, worked up or whatever and start venting it toward MS is defeatist. Work at making it do what you want it to do and seek help from members here in a friendly manner. Being irrate will not prompt anyone to help..... Quote My website
Mehyar Posted July 11, 2003 Posted July 11, 2003 uidgreg, Next time start your own thread, i noticed your question by mistake. Check this url http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q745q I don't know if this exaclty what you need but i hope it helps. Quote Dream as if you'll live forever, live as if you'll die today
Moderators Robby Posted July 11, 2003 Moderators Posted July 11, 2003 I don't see a problem with uidgreg adding to this thread, it has so far been on topic and not out-of-date. Quote Visit...Bassic Software
Co2 Posted July 25, 2003 Author Posted July 25, 2003 hog: I rarely get angry and I wasn't when I wrote this post. I just like to see how people react to it and push things a bit. uidgreg: Thanks for the post but I wasn't looking at changing the color of a row. As for the grid, I went back to an old good activex control that doesn't support ADO.NET. Quote
dchazin Posted August 28, 2003 Posted August 28, 2003 This control is awful. I understand that it is complex, but the documentation and examples Microsoft provide are trivial and insufficient to use it in most real applications. Even worse is that you can make calls to the control through the public API that will cause your application to hang or crash. I also found that it allocates MessageHandlers behind the scenes that do not always get properly released and can lead to memory leaks. Quote
ultraman Posted September 25, 2003 Posted September 25, 2003 I must agree with Co2 on that. I work with this component from the begining and I'm getting used to it. Of course the new Grid is very powerful and allows you to do virtualy anything, caus you now have access to (almost) all objects layer that compose the grid itself. BUT MS should have done a better implementation of some basics for RAD. I don't think it's normal to have to count times between the click in the grid and the click in the TextBox to get a DoubleClick ! Quote Now go on, boy, and pay attention. Because if you do, someday, you may achieve something that we Simpsons have dreamed about for generations: You may outsmart someone! --Homer Simpson
AlexCode Posted September 26, 2003 Posted September 26, 2003 jfackler ... your talk about programing everything from dust and have to put myself on my nees thanking MS for the worst grid I've ever worked on is out of any question... I'm not becoming a graphic designer, I just have to maximize my production time, If buying a Grid that cost $400 will spare me a week time job and even do things that I could not even imagine with the MS DataGrid it worth every cent it costs... See the DevExpress XtraGrid at http://www.devexpress.com and tell how much time would you need to do a quarter of the functionalities with the DataGrid! (I say a quarter because the others 3/4 are just impossible to accomplish!) :D Quote Software bugs are impossible to detect by anybody except the end user.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.