vb.net winform data question

I am trying to bind a list of class to a gridview.
My class:
    Public Class SelectedTableSchema
        Public TableName As String
        Public ColumnName As String
        Public OrdinalPosition As String
        Public ColumnDefault As String
        Public IsNullable As Boolean
        Public DataType As String
        Public CharacterMaximumLength As String
        Public NumericPrecision As String
    End Class

I have created a list of this class
I create a list of several objects of this class
        Dim thisschema As List(Of clsKISSDbTableClasses.SelectedTableSchema)
I can fill and view the list thisschema by looping thru the list and everything looks good

But I cannot get it to work as a datagridview source.

Does anyone have experience doing this?
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Éric MoreauSenior .Net ConsultantCommented:
You cannot just have public members, you need properties. Transform your class to :
Public Class SelectedTableSchema
	Public Property TableName As String
	Public Property ColumnName As String
	Public Property OrdinalPosition As String
	Public Property ColumnDefault As String
	Public Property IsNullable As Boolean
	Public Property DataType As String
	Public Property CharacterMaximumLength As String
	Public Property NumericPrecision As String
End Class

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
trstillAuthor Commented:
  Thank you for the reply.
To make sure I understand.  I need to have properties in order to use a class list for a datagridview?
Reason I ask is I can use the class without Property for any other operation than datagridview binding with no problems.

Thank you,
Tom Stilley
Fernando SotoRetiredCommented:
Hi trstill;

Eric is correct. The DataGridView uses a public property to know which items in the class to display, so if you have no public properties it will not display anything.
Bootstrap 4: Exploring New Features

Learn how to use and navigate the new features included in Bootstrap 4, the most popular HTML, CSS, and JavaScript framework for developing responsive, mobile-first websites.

Éric MoreauSenior .Net ConsultantCommented:
Sure you can use a class containing only public members when you want to DataBind this class, you need to use properties. This is a requirement.
trstillAuthor Commented:
Thanks to Eric for the answer and Fernando for the confirmation.
Now it is doing exactly what I wanted it to do.
In spite of many years experience with .net developing .aspx application it looks like I still have a lot to learn about creating desktop applications.  I'm surprised at the differences.
Tom Stilley
trstillAuthor Commented:
Exactly what I needed
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.