473,768 Members | 3,968 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataGridView Questions

I have a couple questions regarding the DataGridView object...

1) What is the underlying data type that the DataGridView uses if you
are using it unbound and do for instance dgv.Columns.Add (). Is there
any way to access that data type directly, since the DataSource field
is null when the DataGridView is unbound?

2) Is there any way to add a row which does not have as many columns
as the rest of the grid? Basically I have about 10 columns of data
but every so often I want to put an "event" row in the table to show
where an event happened. I pretty much just want that event row to
have 2 columns, one to say the time the event happened and another
with the description of the event. Is this possible in the
DataGridView object, or if not then is it possible in any other native
C# object that I can display in a DataGridView type fashion?

Thanks in advance,
Stu
Nov 19 '08 #1
1 2361
st*******@gmail .com schrieb:
1) What is the underlying data type that the DataGridView uses if you
are using it unbound and do for instance dgv.Columns.Add (). Is there
any way to access that data type directly, since the DataSource field
is null when the DataGridView is unbound?
I am nearly ONLY using unbound grids, but that question never came to my
mind. I usually find that if I _presume_ the underlying datatype to be
of type "string" as long as it is undefined, then I don't have problems.
but every so often I want to put an "event" row in the table to show
where an event happened. I pretty much just want that event row to
have 2 columns, one to say the time the event happened and another
with the description of the event.
Maybe a "ListView" control can even do better what you want. If you want
to stick to the DataGridView you can use the CellPaint-Events to
determine which type of row is displayed.
I never touched the borders of cells for such a purpose, but it should
be possible to make the cell-borders of neighbouring cells disappear in
the beforecellpaint event, for each row that is of type "event".
Nov 20 '08 #2

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

Similar topics

1
3209
by: Brian | last post by:
I've got a couple questions on the new Datagridview control in VS2005. 1) In the old datagrid control at design time I was able to add multiple tablestyles with columns from different datasources. Then at run time when I would bind a dataset to the grid it would display the tablestyle associated with the dataset. How do I do this in VS2005? 2) I do all my databinding to the datagridview at run time, but setup my columns as unbound...
2
529
by: mark carew | last post by:
Hi All DataGridView Users. I have noticed that there seems to be very little useful response to DataGridView questions in this news group. I have looked at the spanish, belgium, french, italian equivalent CS newsgroups and the situation would appear to be much the same. Why this is the case, who knows? But, I have found one link that may be of help in understanding the innards of DataGridView.
1
3744
by: George | last post by:
Hi, I have a DataGridView, bounded to a DataTable which is populated/updated by a OleDbDataAdapter (with OleDbConnection) to an Access Database. (Sounds familiar to some of you ... I have posted a number of related questions already.) I want to have a worker thread starting to consume data from the DataTable. Imagine that the DataTable contains a list of tasks. From the C# .NET specification, DataTable "is safe for multithreaded...
6
50477
by: George | last post by:
Hi, I have been encountering a refresh problem with DataGridView, which is bound to a DataTable. When I make updates (Add, Delete, update) to the DataGridView, everything flow nicely to DataTable. No problem here. However, when I add data (programatically) to the DataTable, the DataGridView does not refresh right away. If I minimize and show my form,
3
8539
by: =?Utf-8?B?UGV0ZXI=?= | last post by:
I'm trying to add a datagridview control to a Windows Form to display read-only information in visual basic 2005. My understanding is that datareader will be faster for this purpose. I have the following questions: 1. Can DataReader be bound DIRECTLY to DataGridView? 2. If DataReader cannot be bound directly to DataGridView, how can I load a DataReader into a DataTable and bind the DataTable to DataGridView? Can the DataTable be a...
0
1216
by: Alcibiade | last post by:
Hi, I have 2 questions: 1)if width datagridview is shorter than form witdh, user will see horizontal scrollbar to see all grid.How can I adapt width form to width datagridview? 2) If a cell contains a long string, even if I increase height cell, string is only at top....how can I enable "multiline" in a datagridview cell?? Thanks ;)
7
6294
by: cj | last post by:
As your probably aware the datagridview doesn't update it's source datatable with changes to a cell until you move off that cell. Suppose somone makes a change in a cell of my datagridview then clicks to go elsewhere in the program--how can I be assured that change is transmitted back to the source datatable?
11
76253
by: dave18 | last post by:
Hello all! I found a solution to my original question, but there's still so much I don't understand about it, I thought I'd give this forum a try. At the very least, maybe it will help someone else who got stumped like I did. It seems so simple... binding a DataGridView to a List<T>. These are the two general problems that I kept running into: (1) When the data in the list updated, the data on the screen did not update. (2) When I...
2
2930
by: Stewart Berman | last post by:
I have an application that populates a DataGridView control with an XML. file. 1. How do I set up the process so the user initally sees just the headers -- no records. I have the DataGridView properties set to allow the user to edit data but not add or delete (which will be down in the program). However when I execute the ReadXML method one emtpy row is shown. The starter XML contains: <?xml version="1.0" encoding="utf-8"?>...
0
9577
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9412
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
10022
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
9969
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
9847
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
8843
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
6659
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
5427
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3938
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.