We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

VB.Net 4 Datagridview Not Showing All Data

rcblevins
rcblevins asked
on
Medium Priority
498 Views
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.
Comment
Watch Question

Commented:
show us some code of how you:

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

Author

Commented:
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

        tb.Load(dataGridViewDR)

        CEIDataGridView.DataSource = tb

        dataGridViewDR.Close()

        dataGridViewDR.Dispose()

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

Open in new window

Author

Commented:
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.
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview

Author

Commented:
Found I had programmed something wrong.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.