Solved

Strange Datagrid behavior.

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

821 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