473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

C# DataGridView - Add Row Dynamically (bounded datasource)

Goo day.

I'm working on a C# application and on this particular form, I have a datagridview control that is bounded to a datasource on load. I've implement a drag-drop event to the datagridview, but I cannot 'add' a row to the form and display the added item!! When I exti the form and open it again, the item i added is displayed! I've gone to severl discussions on this, but nothing has worked so far! I know the data is being saved to the datasource, which is great, but the immediate addition is not realtime. Any advice/comment is appreciated.

1) When a drag drop is done, I add a new item to the datasource list.
Object newObj = new Object();
dsObject.List.Add(newObj);

2) When i try to add a row to the datasource, it does not render on the form. I've tried the following:
DataGridViewRow newRow = null;
DataGridViewComboBoxCell tempCell = new DataGridViewComboBoxCell();
tempCell.Items.Add(<some text here>);
newRow.Cells.Add(tempCell);
myDataGridView.Rows.Add(newRow);

This does not work!!! I thank you in advance for any suggestions.

-Lorentz
Jul 26 '07 #1
0 4864

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

Similar topics

10
by: Henok Girma | last post by:
Hello Gurus, I want to save the state of an unbound DataGridView on my Windows Form application to an XML file so i can later load it back.. Basically, on my form I have a DataGridView, it's got...
1
by: Luca Beretta | last post by:
I think this a simple question but i'm breaking my brain without results. I've a datagridview bounded to a datatable, with an imagecolumn that should contain a different bitmap depending from a...
4
by: Matt | last post by:
I have been searching all over the web for a way to sort a DataGridView based on the actual text being shown in a ComboBox column as opposed to the underlying value (an ID in this case). Can anyone...
0
by: Dave | last post by:
I have a datagridview I call the CellValidating event and if the the cell does not validate I want to reset the cell to a default value. My code actually executes this statement: ...
7
by: =?Utf-8?B?TG9zdEluTUQ=?= | last post by:
Hi All :) I'm converting VB6 using True DBGrid Pro 8.0 to VB2005 using DataGridView. True DBGrid has a MultipleLines property that controls whether individual records span multiple lines. Is...
1
by: =?Utf-8?B?RGF0YUdyaWRWaWV3IGFkZCByb3cgZHluYW1pY2Fs | last post by:
Hi, I am working on the windows application. I created a form Form1 to list records. I used datagridview to show data and bound it to a dataadapter. User can click Update button in Form1 to open...
0
by: Richard Charts | last post by:
After searching the forums, newsgroups, and web, I cannot seem to find a straight answer. Is it possible to use a bounded datasource in virtual mode on a datagridview? I would like to have the...
7
by: Ciri | last post by:
Hi all, I've a problem with a datagridview. The data source of the control is a List<t> where t is type of a class I've created. The class (Person) has some properties like Name, Surname and so on....
0
by: jchaturv | last post by:
All, I have a customized DataGridView where I have implemented extra functionality and bounded datasource in the same custom DataGridView (Using C# and .NET). Now, I could able to use it...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
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...
0
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...

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.