Solved

Strange Datagrid behavior.

Posted on 2004-09-29
2
237 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

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
word0 challenge 3 92
cmd.exe will not close when running .bat file to perform FTP upload 18 104
Help Required 3 97
Query Syntax 17 36
Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
A short article about a problem I had getting the GPS LocationListener working.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

832 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