Solved

How do I fill DataGrid with values on runtime

Posted on 2008-10-03
6
310 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
[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
  • 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
Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

 

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 50 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

691 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