473,734 Members | 2,764 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Adding an unbound - row to a specific index - datagridview bound mode

Is it possible that - or is there any workarround for adding a new unbound row
to a datagridview at bound mode ?
Theese are not working. And i don 't want to add a row to dataset then rebind -
cause i want to add this row to a specific location. and it does not match to
sort order.

Regards. and thanks.

base.Rows.Inser tCopy(base.Curr entRow.Index, 1);
base.Rows.Inser t(base.CurrentR ow.Index, 1);
base.Rows.AddCo pies(base.Curre ntRow.Index, 1);
base.Rows.Inser tCopy(base.Curr entRow.Index, 1);

Jan 7 '06 #1
2 8350
inpuarg,

Well, in order to do this, you have to set your sort order such that the
row will be placed in the order that you desire.

The order of the rows in the data table have nothing to do with the sort
order on a view. You need to change the view so that the sort order will
expose the rows in the order you wish.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"inpuarg" <in*****@wherel and.com> wrote in message
news:g4******** *************** *********@4ax.c om...
Is it possible that - or is there any workarround for adding a new unbound
row
to a datagridview at bound mode ?
Theese are not working. And i don 't want to add a row to dataset then
rebind -
cause i want to add this row to a specific location. and it does not match
to
sort order.

Regards. and thanks.

base.Rows.Inser tCopy(base.Curr entRow.Index, 1);
base.Rows.Inser t(base.CurrentR ow.Index, 1);
base.Rows.AddCo pies(base.Curre ntRow.Index, 1);
base.Rows.Inser tCopy(base.Curr entRow.Index, 1);

Jan 7 '06 #2
well - i 've tried but i have some problems :

DataSet ds = (DataSet)base.D ataSource;
DataTable dt = ds.Tables[0];
DataView dv = dt.DefaultView;

DataRow row = dv.Table.NewRow ();
row["ID"] = System.Guid.New Guid().ToString ().ToUpper();

dv.Table.Rows.I nsertAt(row, base.CurrentRow .Index + 1);
but when user change the default sort this is not working - what can i do ?

On Sat, 7 Jan 2006 15:49:41 -0500, "Nicholas Paldino [.NET/C# MVP]"
<mv*@spam.guard .caspershouse.c om> wrote:
inpuarg,

Well, in order to do this, you have to set your sort order such that the
row will be placed in the order that you desire.

The order of the rows in the data table have nothing to do with the sort
order on a view. You need to change the view so that the sort order will
expose the rows in the order you wish.

Hope this helps.


Jan 12 '06 #3

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

Similar topics

11
2294
by: Steven D'Aprano | last post by:
Suppose I create a class with some methods: py> class C: .... def spam(self, x): .... print "spam " * x .... def ham(self, x): .... print "ham * %s" % x .... py> C().spam(3) spam spam spam
3
4879
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
10
3246
by: Matthew Wells | last post by:
Hello. I've converted a bound Access 2000 form which displays data retrieved from an Access 2000 database to an unbound form. Now my hyperlinks don't work. I'm assuming it's because the form isn't bound anymore. I didn't even have that field's data type as hpyerlink - just test. I did have the form control's "hyperlink" property set to true and it worked fine in bound mode. The fields stores paths to pdf files. How can I make the...
7
1804
by: Max | last post by:
I've included the needed tables in the DataSource. Those tables that are bound to controls I can workwith. But how do you get access to the DataAdaptors that are not bound? me.Dataset1.table is a table with no Insert or Update methods. pll.DataSet1.table has the Row, ChangeEvent, and ChangeEventHandler. It seems like it should be fairly straight forward to use the DataAdapter without binding it to a control. How do you do this?
3
2988
by: Aspnot | last post by:
I have a form that is setup in a Master/Detail configuration. The Detail section is represented with a DataGridView. Some of the columns in this DataGridView control are unbound. When a user clicks the Cancel button, I loop through the tables in my DataSet and call EndCurrentEdit() to determine if HasChanges() is True. And then prompt the user and allow them to Cancel out of the exit. If the user chooses Cancel and any changes have...
7
3644
by: Rainer Queck | last post by:
Hi NG, Why is it, that in my DataGridView all columns which are not bound to a "DataProperty" loos thier content in a couple of occasions? This happens if: - Underlaying DataSet.AcceptChanges() - DataGridView bound columns -Click on header for sorting Is there a event, that I can use to detect this situation and then
1
3424
by: lgalumbres | last post by:
Hi, I have a datagrid on Winform that is bound to a datatable. In essence, what I would like to do is that when a user inputs a number into a textbox control for example 5 then 5 empty rows will appear in the datagrid. any ideas? Im fairly new to vb.net and Ive been reading that manipulating a bound
1
3522
by: Martin | last post by:
Hi, I'm having a problem with a datagridview control when trying to read the value of an unbound checkbox cell. The code below works fine if I click on any text cell, bound or unbound, and also if I click on a data bound checkbox cell. But it fails with null reference exception if I try to read the value on an unbound cell.
7
5577
by: troy_lee | last post by:
I have an unbound form. I have an Add New procedure that saves a new record to the database. What is the best way to update an existing record? In other words, clicking my "Submit record" button creates another new instance of the record when all I want is to update a field or two and save over the existing record. Thanks in advance. Troy
0
8946
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
8776
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
9449
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...
0
9310
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...
0
9182
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
4550
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...
1
3261
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
2
2724
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2180
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.