Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Strange Datagrid behavior.

Posted on 2004-09-29
2
Medium Priority
?
244 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 1500 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
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…

636 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