473,748 Members | 2,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

No definition for Fill. (WinForms)

80 New Member
Edit: I realized just now I misspelled Definition in the title... Sorry.

I'm working on a personal project, where I have a database (SQLite) and a dataGridView.
Now This is what I have:

Expand|Select|Wrap|Line Numbers
  1.  public Form1()
  2.         {
  3.             DataSet ds = new DataSet();
  4.             SqlConnection connection = new SqlConnection(@"Data Source=testingsql2.s3db");
  5.             SqlDataAdapter SQLda = new SqlDataAdapter("Select * from User", connection);
  6.             SqlCommandBuilder SQLcb = new SqlCommandBuilder(SQLda);
  7.             dataGridView1.Fill(ds, "User"); //Error here
  8.             dataGridView1.DataSource = ds;
  9.             dataGridView1.DataMember = "User";
  10.         }
I've marked where I get the error.

And the Error description:
Expand|Select|Wrap|Line Numbers
  1. Error    1    'System.Windows.Forms.DataGridView' does not contain a definition for 'Fill' and no extension method 'Fill' accepting a first argument of type 'System.Windows.Forms.DataGridView' could be found (are you missing a using directive or an assembly reference?)
Anyone know what I could've done wrong?
Feb 13 '13 #1
2 2001
Mikkeee
94 New Member
The DataGridView needs a datasource which you have set. The 'Fill' that your looking at is what adds or refreshes data to your dataset. So... you need to 'Fill' your dataset from the dataadapter and then assign the dataset to the gridview's datasource.

Replace this:
Expand|Select|Wrap|Line Numbers
  1. dataGridView1.Fill(ds, "User"); //Error here
  2.  
With this:
Expand|Select|Wrap|Line Numbers
  1. SQLda.Fill(ds);
  2.  
Feb 13 '13 #2
M1kkelZU
80 New Member
Ah ok thanks it works now :)
Feb 14 '13 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

4
7022
by: Patrick | last post by:
I'm writing a winforms database application in C#. I've come across a lot of stuff lately about "N-Tier" architecture. Can anyone give me a simple explanation of N-Tier? The descriptions that I've found online are chock full of lingo that I simply don't know. I need the "N-Tier" for Dummies description. Talk to me like I'm in kindergarten. Of course, I'm particularly interested in how N-Tier relates to creating a winforms database...
1
3483
by: Brian | last post by:
Was browsing around online for code to connect to a database usign ADO and C#... and i found this very simple but useful reference (http://www.c-sharpcorner.com/database/db_list.asp) However, implementing this into my own project does seem to work. I'm getting an error: 'System.Data.OleDb.OleDbCommand' does not contain a definition for 'Fill' Why would this be?
1
1002
by: Bernd | last post by:
Hi, i have a little problem which is bugging me since a few days. I am using various Forms in my application and now i came to a realy strange situation. The main app is a Form, when a certain userinteraction occours i open another Form. I will call it the second Form from now on. I have added a panel with DockStyle = Fill to the second form. Later i draw an image to this panel (works fine).
0
1666
by: Bernd | last post by:
Hi, i have a little problem which is bugging me since a few days. I am using various Forms in my application and now i came to a realy strange situation. The main app is a Form, when a certain userinteraction occours i open another Form. I will call it the second Form from now on. I have added a panel with DockStyle = Fill to the second form. Later i draw an image to this panel (works fine).
1
6796
by: Luis Esteban Valencia | last post by:
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0117: 'System.Data.DataTable' does not contain a definition for 'WriteXml' Source Error:
4
1220
by: Floppy Jellopy | last post by:
Hello, I was recently asked to look at someones code to see if i could determine why a particular form was failing to load and instead generating an error about a lack of available resources for that locale. The form inherited from a base form and was defined with an inline namespace rather than defaulting to the project option dialog namespace. Prior to the class/form definition, an enum was defined within the namespace scope as below (...
3
2680
by: Karine Proot | last post by:
Hello, I created two reports : - OleDbReport.rpt, with an OLE DB (ADO) data source (took only table 'stores' from database 'pubs') - DataSetReport.rpt, with an ADO.NET DataSet as a data source (this dataset contains only tables 'stores' as in 'pubs' database) I created a winform, with a CrystalReportViewer in it.
4
1301
by: gregory_may | last post by:
I have a regular windows forms application that I need to automatically fill in some information into..... But the manufacture has no published API's or web services. Everything must be via their GUI. Is there some technique that would allow a .Net program to fill in any winforms text box with some information (from my own database pull)? Thanks! (I posted this on the Vb.Net form, but just realized the same technique
0
1946
by: khurram.shakir | last post by:
I am developing an application, which uses .NET 2.0/WinForms and has a designer for screen layout designing. User has an option to design the layout of screen, and for that we developed our own controls based on UserControl Class. After the designing the layout is saved as an XML, and we have a Loader of XML that renders the layout afterwards. When we load the controls and layout from xml, every thing works fine except we are facing...
0
1246
by: gao1183 | last post by:
I am given an Ellipse in the following definition: <Path Name="_Display2_Ellipse2" Height="50" Width="60" Stroke="black" StrokeThickness="1" Fill="teal" Visibility="Visible"> <Path.Data> <EllipseGeometry Center="0,0" RadiusX="1" RadiusY="1"> <EllipseGeometry.Transform> <MatrixTransform> <MatrixTransform.Matrix> <Matrix M11="76.5" M12="0" M21="0" M22="-27"
0
8832
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9332
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.