473,763 Members | 4,808 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Windows Forms - DataGridView - Empty Row

I have a Windows Application that uses a DataGridView for displaying
read-only data. Everything work fine, except when my datasource has no data.
Ideally, when there is no data I would like to display the column headers
with no data rows, but instead it displays the headers with an empty data
row, which leads the user to believe that there is data when there isn't any.
Does anyone know how to hide this empty row? (I already have
AllowUserToAddR ows set to false.)
Sep 18 '06 #1
2 5423
Bryan,

You can use a dataview as datasource and set in that allownew to false.

I hope this helps,

Cor

"Bryan" <Br***@discussi ons.microsoft.c omschreef in bericht
news:F2******** *************** ***********@mic rosoft.com...
>I have a Windows Application that uses a DataGridView for displaying
read-only data. Everything work fine, except when my datasource has no
data.
Ideally, when there is no data I would like to display the column headers
with no data rows, but instead it displays the headers with an empty data
row, which leads the user to believe that there is data when there isn't
any.
Does anyone know how to hide this empty row? (I already have
AllowUserToAddR ows set to false.)

Sep 18 '06 #2
I tried that as well, but the DataGridView still creates an empty row, even
though the DataTable/DataView.Rows.C ount=0.

"Cor Ligthert [MVP]" wrote:
Bryan,

You can use a dataview as datasource and set in that allownew to false.

I hope this helps,

Cor

"Bryan" <Br***@discussi ons.microsoft.c omschreef in bericht
news:F2******** *************** ***********@mic rosoft.com...
I have a Windows Application that uses a DataGridView for displaying
read-only data. Everything work fine, except when my datasource has no
data.
Ideally, when there is no data I would like to display the column headers
with no data rows, but instead it displays the headers with an empty data
row, which leads the user to believe that there is data when there isn't
any.
Does anyone know how to hide this empty row? (I already have
AllowUserToAddR ows set to false.)


Sep 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3445
by: Felipe Roucher | last post by:
Hello, I 've a Windows Form and a "DataGridView" with the "DataSource" binding with a "BindingSource" and a "BindingNavigator", in the other hand in the same Form, there's multiples textbox's binding with the same "BindingSource". Well, only I want to know if there's any automatic way to change the values of all selected rows in a datagridview, when I change the TextBox's text. Thank you.
2
32493
by: Chris Peeters | last post by:
Hi, I set up some columns in a DataGridView. I fill the DataGridView with some records by executing an sql-select statement .. so far so good Afterwards I clear the DataGridView using : ((DataView)dataGridView1.DataSource).Table.Clear()
0
2174
by: MKBender | last post by:
Hello everyone, What I'm currently trying to do is allow a user to add a row to my datagridview. I have AllowUserToAddRows set to true. And the empty now does appear at the bottom of my data. The datagridview has a data source set to a datatable. The code currently allows a user to add the row properly and the data is making it into the datatable. So what I want to do know is auto fill in an ID column as soon as the user starts editing...
1
4661
by: jon.paine | last post by:
Hi All - I'm working on my first real c# windows forms - but I've done c# web development for awhile. The problem that I'm running into is with defining a layout structure for a dataGridView cell. In a gridview or a datarepeater you can use a template, but that flexability doesn't seem readily available in the dataGridView. Is there a way to apply that kind of control (item template w/
1
3806
by: seanmle | last post by:
I want to build a windows application that has a datagrid filled with data. When a person modifies information on a single cell, it updates the database without the user having to click on a save button. Any ideas on how I can accomplish this? Thanks, Sean
1
7848
by: mfunkmann | last post by:
Hi, I recently got an error and I don't know how to fix it: Error 1 'System.Data.DataColumn' does not contain a definition for 'Windows' C:\c#\CsharpPRO\Form1.Designer.cs 304 77 CsharpPRO I am note sure what to do because all propertiers work, except the System.Data.DataColumn.. I didn't write any code by hand and used the visual studio to set the properties..
0
7174
by: Dennis Francek | last post by:
Hello I have populated a treeview from my dataset and by clicking in the treeview i want to get the corresponding table shown in a datagridview. Ive managed this by looking at each DataRow and child rows and added the nodes with a columnname from each datarow. At the same time i have put in a tag at each treenode with a filter string and the current table im looking at as a string to use for later so i can create a datatable and set a filter...
1
1739
by: JustinD30324 | last post by:
Hello. I have a DataGridView that is bound to a DataTable. If the user types in values for all the columns for the first row, then clicks into a column in the second row (empty), and then clicks back into the first row he just typed, then an empty row is added to the DataGridView. I'm guessing that somehow the AddRow function is being called when the user clicks in and out of the empty row. I don't want this to happen. A new row should...
1
2117
by: jgabrielson | last post by:
Hello All, I have a windows application that exports data from a datagridview into excel. Now this data can change based on what a user does in the datagridview itself. An example would be out of 1,000 files the user can sort through using DataGridViewAutoFilter to search for a handful of rows, say 50 or 143 or whatever. The user then clicks on the button which exports to the excel worksheet. I'm looking for some help on getting a subtotal...
0
9386
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
9997
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9937
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,...
0
9822
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8821
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6642
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
5270
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
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.