Note that there are some explanatory texts on larger screens.

plurals
  1. POBuild DataGridView table without a source?
    primarykey
    data
    text
    <p>I have never managed to get DataGridView working as I needed, but I am back at it again and hoping that I can get it figured out. I currently have a class where I store a lot of data about each individual Support Ticket that comes into our software, but I want to only display some of this data on a DataGridView.</p> <p>The class looks as follows...</p> <pre><code>public class Ticket { public string ID { get; set; } public string TicketID { get; set; } public string DeptID { get; set; } public string UserID { get; set; } public string Name { get; set; } public string Email { get; set; } public string CC { get; set; } public string Subject { get; set; } public string Message { get; set; } public string Status { get; set; } public string Priority { get; set; } public DateTime Date { get; set; } public DateTime LastResponse { get; set; } public IPAddress IP { get; set; } } </code></pre> <p>I want to build a table that shows Name/Message/Priority or some combination of these values, but definitely not all of them. Is there any way that I can simply just build the table data from scratch rather than having to supply it a data source?</p> <p>Here is my test code implementing the suggestion below but I get "No Row can be added to DataGridView control that does not have columns".</p> <pre><code> WHMCS x = new WHMCS(); List&lt;WHMCS.Ticket&gt; Tickets = new List&lt;WHMCS.Ticket&gt;(); Tickets = x.Get_Tickets(); KryptonDataGridView dgv = new KryptonDataGridView(); content1.Controls.Add(dgv); foreach (var tix in Tickets) { var objArr = new object[] {tix.Priority, tix.Subject}; dgv.Rows.Add(objArr); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload