I’m using Dapper to create an equipment inventory from my database. Multiple comments are mapped from a Comments table to the Comments property of EquipmentModel. I’ve successfully used StringBuilder to populate the inventory in a MessageBox (due to helpful Reddit coders). Now, I’d like to take the list of objects and populate a DataGridView. Here’s what I have so far.
The query:

The class definition:
As far as I can tell, GetEquipmentList() returns a list of EquipmentModel, so I should be able to use that function to initialize the DataGridView, which is named InventoryGridView:

Everything compiles nicely–no errors–but the DataGridView is empty. (For the record, there are records in my database. They appear when I convert them to strings and display them in a Messagebox.)

In a related question, if anyone cares to weigh in, I’m new to programming–only a few months under my belt–and this is my first project. I know the fundamentals from using VBA extensively since early January, but C# is way more in depth. I tend to throw myself into the deep end of the pool until I learn to swim, and it’s always worked for me in the past. And it’s working for me so far. But is this a backwards way of learning to program?
Your method is async but you don’t await it so you are setting the data source to the returned task not it’s return value. Try accessing the Result property of the task. So

InventoryGridView.DataSource = InitializeInventoryList().Result;
Really you should be using something like
var list = await InitializeInventoryList();

You could do this by adding an async event handler to FormLoad or similar and it call it in there as constructors can’t be async. I think it’s generally advised not to do stuff like this in a constructor. You may need to invoke the code to update UI elements though.

Thank you for your reply. Would it look something like this? I’ve made this change, but still the column headers and content are not in the DataGridView.

source