Displaying and manipulating data in a windows form, Which control should I use?

amalgamate

I want to display data in a windows form using C# .NET. So that’s good, there are many ways to do that. The data is coming in as a flat text file. Some of the data should be displayed as a single element that stretches across the control (a comment line), while other data should be displayed in a table with many columns. Yet, I want the whole list, including comments, to be displayed in one single list.

My problem is that at this point I am not sure what control I should/could use to display this irregular data, or what approach I should take. What would part of the c# forms controls should I be learning about and planning to use in order to fill my goals. My current candidates are vacillating between ListView and DataGridView. What tool(s) can be used to fill this need where some table rows will be a single column and others will be multiple columns, if any.

Lets say my data looks like this:

red       | green    | purple   | blue
comment that is one single piece of data
Foo----------------- | Bar---------------
red-------| green--- | purple-- | blue
one       | green    | purple   | blue
Foo----------------- | Bar---------------
one       | two      | three    | four
comment that is one single piece of data
comment that is one single piece of data
red       | green    | purple   | blue
one       | green    | purple   | blue
Foo----------------- | Bar---------------
one       | two      | three    | four
Vland

It would be very helpful to see the structure of your data. What in the world is a "unified comment - list"? What do you mean by "irregular data"?

Anyway, in my experience, the best tool in Winforms to deal with tabular data is DataGridView. You can have combobox cells, image cells. You can easily format and color them, validate and disable when necessary.


Edit: more info

What you need is basically some colspan, easibly obtainable in HTML grids. You can't do that easily in DataGridView, quoting the Ms DataGridView program manager

The DataGridView does not have any support for merging cells. You can custom paint
content across cells, but apart from that you would have to do a lot of work and
custom coding to produce merged editable cells.

but you could buy a 3rd party component (Telerik GridView or similar) or search for a custom implementation like this:

DataGridVewTextBoxCell with Span Behaviour

Maybe this can be useful too:

Multi Column Combo Cell for the .NET 2.0 DataGridView Control

http://social.msdn.microsoft.com/Forums/windows/en-US/fea3dcff-5447-450a-8f7c-bb1c4f63371d/merging-cells-in-datagridview?forum=winformsdatacontrols


EDIT 3: Ok, if you just need to display your data why don't you try adding in your winform a webBrowser component, compose your HTML text and then display it? You can add style, font, colors etc etc like any web page.

Sample

private void showHtml()
{
    var htmlstring = @"<html><table border='1'>
      <tr>
        <td>Red</td>
        <td>Green</td>
        <td>Purple</td>
        <td>Blue</td>
      </tr>
        <tr>
        <td colspan='4'>Comment that is one single piece of data</td>
      </tr>
       <tr>
        <td colspan='2'>Foo</td>
         <td colspan='2'>Bar</td>
      </tr>
      <tr>
        <td>Red</td>
        <td>Green</td>
        <td>Purple</td>
        <td>Blue</td>
      </tr>
      <tr>
        <td>Red</td>
        <td>Green</td>
        <td>Purple</td>
        <td>Blue</td>
      </tr>
          <tr>
        <td colspan='4'>Comment that is one single piece of data</td>
      </tr>
      <tr>
        <td>One</td>
        <td>Two</td>
        <td>Three</td>
        <td>Four</td>
      </tr>
    </table>
    </html>";
    webBrowser1.DocumentText = htmlstring;
}

http://oi40.tinypic.com/2uygkjt.jpg

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Which data structure should I use in Java?

From Dev

which database should I use for simple log in register form in android

From Dev

Which data structure should I use to handle multi value data?

From Dev

Which library should I reference to use SQLite with Windows 8.1 StoreApp

From Dev

To use Windows and Ubuntu on one computer, which should I install first?

From Dev

Which IDE should I use for Windows 8 Phone development?

From Dev

To use Windows and Ubuntu on one computer, which should I install first?

From Dev

Which library should I reference to use SQLite with Windows 8.1 StoreApp

From Dev

Reinstalling windows 10 free upgrade, which key should i use

From Dev

which library should I use for big data project

From Dev

which class should I use to collect and store different data types?

From Dev

Which method should I use to send data to Apple Watch and back?

From Dev

which class should I use to collect and store different data types?

From Dev

Which data structure should I use to search a string from CSV?

From Dev

Which method should I use to send data to Apple Watch and back?

From Dev

Which data structure should I use for maintaining this information?

From Dev

Which clustering algorithm should I use for frequency data?

From Dev

Which data type should i use to store YouTube video durations?

From Dev

I want to use WebBrowser Control in Mono Windows Form

From Dev

Which FunctionalInterface should I use?

From Dev

Which SimpleCursorAdapter should I use?

From Dev

Which Association Should I Use?

From Dev

Which API should I use?

From Dev

Which model should I use?

From Dev

For submiting HTML form data should I use the variable, "id", or "name"

From Dev

Which control primitive should I use to avoid a syntax error during compilation?

From Dev

Which android control should i use to get 2 by 2 scrollable grid in android?

From Dev

What form of task control should I use to handle a long-running processes in MVC using SignalR

From Dev

What event should I use in a User Control on a form refresh/requisition on Genexus?

Related Related

  1. 1

    Which data structure should I use in Java?

  2. 2

    which database should I use for simple log in register form in android

  3. 3

    Which data structure should I use to handle multi value data?

  4. 4

    Which library should I reference to use SQLite with Windows 8.1 StoreApp

  5. 5

    To use Windows and Ubuntu on one computer, which should I install first?

  6. 6

    Which IDE should I use for Windows 8 Phone development?

  7. 7

    To use Windows and Ubuntu on one computer, which should I install first?

  8. 8

    Which library should I reference to use SQLite with Windows 8.1 StoreApp

  9. 9

    Reinstalling windows 10 free upgrade, which key should i use

  10. 10

    which library should I use for big data project

  11. 11

    which class should I use to collect and store different data types?

  12. 12

    Which method should I use to send data to Apple Watch and back?

  13. 13

    which class should I use to collect and store different data types?

  14. 14

    Which data structure should I use to search a string from CSV?

  15. 15

    Which method should I use to send data to Apple Watch and back?

  16. 16

    Which data structure should I use for maintaining this information?

  17. 17

    Which clustering algorithm should I use for frequency data?

  18. 18

    Which data type should i use to store YouTube video durations?

  19. 19

    I want to use WebBrowser Control in Mono Windows Form

  20. 20

    Which FunctionalInterface should I use?

  21. 21

    Which SimpleCursorAdapter should I use?

  22. 22

    Which Association Should I Use?

  23. 23

    Which API should I use?

  24. 24

    Which model should I use?

  25. 25

    For submiting HTML form data should I use the variable, "id", or "name"

  26. 26

    Which control primitive should I use to avoid a syntax error during compilation?

  27. 27

    Which android control should i use to get 2 by 2 scrollable grid in android?

  28. 28

    What form of task control should I use to handle a long-running processes in MVC using SignalR

  29. 29

    What event should I use in a User Control on a form refresh/requisition on Genexus?

HotTag

Archive