[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How do I fill DataGrid with values on runtime

Posted on 2008-10-03
6
Medium Priority
?
315 Views
Last Modified: 2013-11-17
I am trying to compile a sample application that is a datagrid which is connected to a dataset (which is a table in database).

I've connected all the elements but failed to fill in data in the grid (from the table) --
How do I accomplish that?
0
Comment
Question by:amitbueno
  • 3
  • 2
6 Comments
 
LVL 7

Expert Comment

by:the_bachelor
ID: 22634092
I think your question is rather vague as it does not tell which technique your're employing to "connect" your stuff.
A little code will be welcome here...
0
 

Author Comment

by:amitbueno
ID: 22634188
Hard so post a code,. because all I did was in design time.
In delphi connecting a datagrid to database done visually,. I thought that in vs vb as well... (though I probably was mistaken)

In design time, I created a wince application, put a datagrid on the fom. Created a database with a table...
Assigned DataSet,. And databinding, and created a datamember which is the table from the database,. in the dataset I specified the database, and datamember.

Now I would like to display a grid with the table data in it.
0
 
LVL 7

Expert Comment

by:the_bachelor
ID: 22634658
Sorry I for some odd reason thought you was using ASP.NET. Sounds like u're building a Windows app.
Question for you: Does the database itself has data in it?

Here is what i did, might help you. I'm using VS 2008.
So I dragged a DataGridview on my form, added a Project Datasource as prompted, Selected a table and Boom I got data bound the grid...
0
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 

Author Comment

by:amitbueno
ID: 22634831
I am using .NET Compact Framework.
It doesn't have the DataGridView only DataGrid... But I think it is the same as the datagridview.
I selected a database and a table in the DataSetBindingSource, and assigned the Grid to it.

If that is enough why don't I see the data when running the application?
The database is with data in it of course...
0
 
LVL 15

Accepted Solution

by:
JackOfPH earned 150 total points
ID: 22639043
Set the datasource of the datagrid in the form load event of the form.

For example put this code in the Form Load Event:

Datagrid1.Datasource = Dataset.Table("YourTable")
0
 

Author Comment

by:amitbueno
ID: 22640060
A little progress...

I've designed in design time, the datasource to point to the table,. Yet when running the code it raises an exception saying that the table doesn't exist (although I've designed a reference to it)
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Suggested Courses
Course of the Month19 days, 9 hours left to enroll

872 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