Solved

Strange Datagrid behavior.

Posted on 2004-09-29
2
241 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

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.
A short article about problems I had with the new location API and permissions in Marshmallow
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
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…

707 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