CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Nov 2005
    Posts
    10

    [RESOLVED] How to get data in datagridview to display at runtime?

    I'm using Visual Basic 2008 in Windows 7. I've added a datasource to my project and dragged an element, a sort query, from Data Sources onto my form. It automatically created a DataViewGrid and placed this statement in my form load event: Me.SortBillsTableAdapter.Fill(Me.DoBills_2009DataS et.sortBills). The datagrid view shows all the fields/columns. When I preview the data element from right clicking the element, selecting Preview Data, and click Preview in the Preview Data dialog box, the data appears. But it does not appear when I run the app. The datagridview is empty. What am I missing to get the data to display in the grid at run time? I did notice that in the properties for the dataviewgrid the databindings property is empty. Is that right or am I supposed to do something there?

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to get data in datagridview to display at runtime?

    My crystal ball crashed today, so I'd have to see some actual code to even begin to understand what you might be talking about. Sorry for the inconvenience!
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: How to get data in datagridview to display at runtime?

    What you are describing does make sense to me

    I suggest you do a search :
    http://www.codeguru.com/forum/search.php

    As this question has been asked and answered numerous times before.

  4. #4
    Join Date
    Nov 2005
    Posts
    10

    How to get data in datagridview to display at runtime?

    I have followed precisely the tutorial steps in the help that comes with VB2008 to create a form, add the datasource, and create the datagridview. That's the end of the tutorial before it goes on into customizing data formatting, etc., so I assumed that was all I needed to do. The data shows up in preview for both the binding source and the table adapter but not when I run the app. I have searched MSDN and all I could find was what I have already done. I have searched through every thread on CodeGuru that had anything to do with datagridview, all 307 of them, and could not find anything specific to my issue. I've even tried doing this in C# and I get the same problem. I'm getting really frustrated. All I want to do is recreate a small app I did in VB6 so it will run in Windows 7, and I can't get past this seemingly simple but vital step in the project.

    Here's the code I have so far, all of which was generated automatically when I followed the steps of the tutorials I've been able to find:

    Public Class Form1

    Private Sub BillsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BillsBindingNavigatorSaveItem.Click
    Me.Validate()
    Me.BillsBindingSource.EndEdit()
    Me.TableAdapterManager.UpdateAll(Me.DoBills_2009DataSet)

    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    'TODO: This line of code loads data into the 'DoBills_2009DataSet.Bills' table. You can move, or remove it, as needed.
    Me.BillsTableAdapter.Fill(Me.DoBills_2009DataSet.Bills)

    End Sub
    End Class

  5. #5
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: How to get data in datagridview to display at runtime?

    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  6. #6
    Join Date
    Nov 2005
    Posts
    10

    Re: How to get data in datagridview to display at runtime?

    _____________________________________________________________________________________
    Solution:

    That's it! Thanks Arjun Paudel for the link. Here's the solution as found on XNA Creator's Club Online. It's by Stephen Styrchak.


    The following erorr:

    The 'Microsoft .ACE.OELDB.12.0' provider is not registered on the local machine

    suggests me to believe that you are compiling for 64bit

    I dont have express edition but are following steps valid in 2008 express?

    http://forums.xna.com/forums/t/4377.aspx#22601

    http://social.msdn.microsoft.com/For...?prof=required
    Arjun Paudel
    _____________________________________________________________________________________

    In VC# Express, this property is missing, but you can still create an x86 configuration if you know where to look.

    It looks like a long list of steps, but once you know where these things are it's a lot easier. Anyone who only has VC# Express will probably find this useful. Once you know about Configuration Manager, it'll be much more intuitive the next time.

    1.In VC# Express 2005, go to Tools -> Options.
    2.In the bottom-left corner of the Options dialog, check the box that says, "Show all settings".
    3.In the tree-view on the left hand side, select "Projects and Solutions".
    4.In the options on the right, check the box that says, "Show advanced build configuraions."
    5.Click OK.
    6.Go to Build -> Configuration Manager...
    7.In the Platform column next to your project, click the combobox and select "<New...>".
    8.In the "New platform" setting, choose "x86".
    9.Click OK.
    10.Click Close.
    There, now you have an x86 configuration! Easy as pie! :-)

    I also recommend using Configuration Manager to delete the Any CPU platform. You really don't want that if you ever have depedencies on 32-bit native DLLs (even indirect dependencies).

    Stephen Styrchak | XNA Game Studio Developer
    http://forums.xna.com/forums/p/4377/22601.aspx#22601
    _____________________________________________________________________________________

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured