Click here to Skip to main content
15,742,357 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dim table As New DataTable("Items")
        table.Columns.Add("Barcode", Type.GetType("System.32"))
        table.Columns.Add("ItemName", Type.GetType("System.32"))
        table.Columns.Add("ItemDescription", Type.GetType("System.32"))
        table.Columns.Add("Price", Type.GetType("System.32"))
        DataGridView1.DataSource = table
        table.Rows.Add(txtBar.Text, txtName.Text, txtDesc, 1, txtPrice.Text)
        DataGridView1.DataSource = table

What I have tried:

can you help me resolve this? How to achieve this functionality?
Updated 20-Oct-16 6:47am
[no name] 20-Oct-16 12:30pm
Richard MacCutchan 20-Oct-16 12:40pm    
What is "System.32" supposed to represent?

1 solution

Um...two things.
First, you add 4 columns, then try to provide 5 values...

Second, "System.32" is not a recognised datatype, so GetType returns null (or Nothing)
Probably, you want to use the name of the actual type, like "System.String" for the ItemName, and so forth.
Share this answer
CaptainChizni 20-Oct-16 13:02pm    
Thank You
OriginalGriff 20-Oct-16 13:59pm    
You're welcome.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900