Solved

Strange Datagrid behavior.

Posted on 2004-09-29
2
235 Views
Last Modified: 2010-04-17
I'm trying to populate a datagrid with an untyped datatable in a winform. Below is the code I'm running. Can anyone explain why, after I set the datasource property, the code keeps running (exception free), and the form never appears? This code resides in the form load event. When I comment out the DataSource line, the form comes up fine, so I'm guessing whatever the problem is in that line. I've verified that I'm getting back a valid Datatable with populated values. I've used grids many times before without ever seeing this problem. I haven't set any of the Datagrid properties, they're all the defaults.

I've tried populating a Dataset, dataview, etc...Nothing works.

Dim i As Integer
Dim dt As New DataTable

Try
            olMgr = New SystemMgr

            dt = olPlayerMgr.GetMembers
           
            DataGrid1.DataSource = dt

        Catch ex As Exception
            Dim Err As ErrorLogger = New ErrorLogger
            Err.HandleError(slErrLogPath & slErrLogFile, ex, "")
            Err = Nothing
        Finally

        End Try
0
Comment
Question by:wgyger12
2 Comments
 

Accepted Solution

by:
blksht earned 500 total points
ID: 12185584
Hi wgyger12,

Reading your problem I don't exactly why the form isn't showing up but offer the following suggestions:
1) have you setting break points in the form load sub to see the process execution? I don't see anything wrong with what you are doing that would be causing it to hang like that but by stepping through the code you may discover the code is not hanging where you think it is. For example, an exception might be thrown and you might actually be hanging in the catch statement.

2) as I understand it you need to call datagrid1.databind() to bind the data source to the datagrid.

sorry if this wasn't much help.....
0
 

Author Comment

by:wgyger12
ID: 12185617
Thanks for the post. Shortly after I submitted my query here, I created a new form, copied all controls and code into it from the original, and ran it again. Oddly enough, it worked fine. Something was corrupt with the original, but I can only guess.  Wish I'd done that before I spent 4 hours looking into why the form wouldn't appear.

I've personally never had any problems with winforms or controls even remotely similar to this.

0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

758 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

21 Experts available now in Live!

Get 1:1 Help Now