VB.Net 4 Datagridview Not Showing All Data

Posted on 2011-04-27
Last Modified: 2012-08-13
I have a datagridview that I'm binding the source to dynamically at runtime.  When I run the program the datagridview only displays one columns data.  All others are blank.  I've checked the datapropertynames and they are all correct and all of the data is correct and there coming from the database.  The only difference that I can think of is tha the one column that is displaying data is text and the others are numbers.  I wouldn't think that would make a difference, but you never know.  Does anyone have any suggestions?

Thanks for any and all help.
Question by:rcblevins
    LVL 17

    Expert Comment

    show us some code of how you:

    1. Get the data from the database
    2. Bind the data to the grid


    Author Comment

    This is the code I'm using is below.  I simply pass the sql command name and the data grid to this code and it fills the data grid.  Other parts of the program are working correctly using this same code.  Is something configured wrong on the datagrid.  I've went over it several times and everything seems to be configured correctly.  Thanks for your help.
    Dim db As New DBHelpers
            Dim tb As New DataTable

            Dim dataGridViewDR As SqlDataReader = db.ExecuteProcedureReturnSqlDR(commandName, Parameters)

            CEIDataGridView.AutoGenerateColumns = False


            CEIDataGridView.DataSource = tb


    LVL 17

    Expert Comment

    what is dataGridViewDR in tb.Load(dataGridViewDR)?
    Also, try
    CEIDataGridView.AutoGenerateColumns = True

    Open in new window


    Author Comment

    dataGridViewDR is the datareader that i"m using to get the data from sql server to load into the data grid.  Sorry I should have specified that I am manually creating the columns in the datagridviews, which is why autogeneratecolumns is set to false.  Is there anything that may not be configured properly on the datagridview that may be causing this problem.  All the columns have the correct datapropertynames and one column is displaying data.  Thanks for your help.

    Accepted Solution

    Sorry, I've found the problem.  I was loading the same data grid 3 difference times with different data, which explains why the data wasn't present in some of the columns.  Thanks for everyones help.

    Author Closing Comment

    Found I had programmed something wrong.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now