Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7401587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:30:43+00:00 2026-05-29T04:30:43+00:00

I have created a Datagridview with 4 Columns, EJ: ID, Name, Quantity, other But

  • 0

I have created a Datagridview with 4 Columns, EJ:

ID, Name, Quantity, other

But i want to fill these 3 Columns from MySQL EJ:

item_id, item_name, item_quantity

I tryed this code:

    Using cn As New MySqlConnection("server=10.10.2.1;userid=root;password=gf-159753;database=quick_admon")
        cn.Open()

        Dim da As New MySqlDataAdapter("SELECT * from qa_items", cn)
        ' DataTable  
        Dim dt As New DataTable

        ' llenar el DataTable  
        da.Fill(dt)

        ' enlazar el DataTable al BindingSource  
        list_items.DataSource = dt

        With list_items 
            .MultiSelect = False 
            .SelectionMode = DataGridViewSelectionMode.FullRowSelect

            .DataSource = list_items.DataSource
        End With

    End Using

but this creates new columns and does not write to the existing, took a while looking for a solution but only find methods like this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T04:30:43+00:00Added an answer on May 29, 2026 at 4:30 am

    You failed to bind the columns from your query into your datagrid view columns. To do this,

    1.) Right Click DataGridView.
    2.) A Popup Menu appears and Click Edit Columns
    3.) Bind each columns (ID, Name, Quantity, other) by typing the field name (item_id, item_name, item_quantity) respectively from
    your query in the DataPropertyName property (so that it will not
    create another column like you did
    ).

    And you’re done!

    UPDATE

    Setting DataPropertyName Propgramatically

    list_items.Columns("ID").DataPropertyName = "item_id"
    

    or Assuming that ID is your first column:

    list_items.Columns(0).DataPropertyName = "item_id"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a datagridview with 3 columns as below : SR no tasks
I have a DataGridView that uses databinding, with manually created columns, and this works
I have created a few small flash widgets that stream .mp3 audio from an
Right now, I have created a new Object data source based off from an
Hey guys, I have an application that I want to display some data from
I have a DataGridView I also have some tableAdapters (groupTableAdapter, userTableAdapter) generated from sqlserver
I'm new to using the C#/.NET programming Language and I have created a DataGridView
I'm having some trouble with VisualStudio 2010 C# Winforms. I have created a DataGridView
I have a c# winform application (2008) with datagridview bound to data from sqlserver.
I have a DataTable which is bound to DataGridView . DataTable has several columns

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.