Windows Forms, csharp, 20 rows in DataTable 14 shown in view after filter
applied. For any of the 14 how do I do the datarow or something else thing
to access the data in the row of the table behind the view selected on the
datagrid.
DataGrid only gives an index based on the 1-14 visible on the datagrid and I
can't seem to update anything I see in the dataview quickwatch that I can
update the underlying row. I could manually keep track of the index to the
datatable but if I could figure out how to update the table behind the
dataGrid index of the view without a lot of looping, comparing, etc. 5 8006
I'm not sure I understand the question completely, but would using a DataSet
work for this?
Put the DataTables in a DataSet and then make the DataSet the source for the
DataGrid.
"Richard" <a@b.com> wrote in message
news:NF******** **********@twis ter.nyc.rr.com. .. Windows Forms, csharp, 20 rows in DataTable 14 shown in view after filter applied. For any of the 14 how do I do the datarow or something else thing to access the data in the row of the table behind the view selected on the datagrid.
DataGrid only gives an index based on the 1-14 visible on the datagrid and I can't seem to update anything I see in the dataview quickwatch that I can update the underlying row. I could manually keep track of the index to the datatable but if I could figure out how to update the table behind the dataGrid index of the view without a lot of looping, comparing, etc.
Richard,
I'm not following what you want?
A DataView is a "live" view into a DataTable.
Updating a row in a DataView updates the corresponding row in the DataTable.
As you know DataTable contains a collection of DataRow objects. The DataView
itself contains a collection of DataRowView objects. DataRowView has a Row
property that is the DataRow itself in the DataTable.
You really shouldn't need to track any indexes, as that is the DataView's
job.
Hope this helps
Jay
"Richard" <a@b.com> wrote in message
news:NF******** **********@twis ter.nyc.rr.com. ..
| Windows Forms, csharp, 20 rows in DataTable 14 shown in view after filter
| applied. For any of the 14 how do I do the datarow or something else thing
| to access the data in the row of the table behind the view selected on the
| datagrid.
|
| DataGrid only gives an index based on the 1-14 visible on the datagrid and
I
| can't seem to update anything I see in the dataview quickwatch that I can
| update the underlying row. I could manually keep track of the index to the
| datatable but if I could figure out how to update the table behind the
| dataGrid index of the view without a lot of looping, comparing, etc.
|
|
Hi Richard,
This isn't difficult. When you do a .find on a dataview, it returns the row
index. The following syntax enables you to update that very row, without
looping of any kind:
If ifind <> -1 Then ' ie, found it
dsprod.Tables(0 ).Rows(ifind)(" copywt") = "abcd"
dsprod.Tables(0 ).Rows(ifind)(" onsaledt") = CDate("05/10/2003")
End If
HTH,
Bernie Yaeger
"Richard" <a@b.com> wrote in message
news:NF******** **********@twis ter.nyc.rr.com. .. Windows Forms, csharp, 20 rows in DataTable 14 shown in view after filter applied. For any of the 14 how do I do the datarow or something else thing to access the data in the row of the table behind the view selected on the datagrid.
DataGrid only gives an index based on the 1-14 visible on the datagrid and I can't seem to update anything I see in the dataview quickwatch that I can update the underlying row. I could manually keep track of the index to the datatable but if I could figure out how to update the table behind the dataGrid index of the view without a lot of looping, comparing, etc.
Now that I learned the current row index of the data grid corresponds to the
DataRowView's copy of the bound data table's record, I think I can refine it
with the copywt code below. I use a single table which is not in a dataset
but I think it will still work.
"Bernie Yaeger" <be*****@cherwe llinc.com> wrote in message
news:ur******** ********@TK2MSF TNGP10.phx.gbl. .. Hi Richard,
This isn't difficult. When you do a .find on a dataview, it returns the
row index. The following syntax enables you to update that very row, without looping of any kind: If ifind <> -1 Then ' ie, found it
dsprod.Tables(0 ).Rows(ifind)(" copywt") = "abcd"
dsprod.Tables(0 ).Rows(ifind)(" onsaledt") = CDate("05/10/2003")
End If
HTH,
Bernie Yaeger "Richard" <a@b.com> wrote in message news:NF******** **********@twis ter.nyc.rr.com. .. Windows Forms, csharp, 20 rows in DataTable 14 shown in view after
filter applied. For any of the 14 how do I do the datarow or something else
thing to access the data in the row of the table behind the view selected on
the datagrid.
DataGrid only gives an index based on the 1-14 visible on the datagrid
and I can't seem to update anything I see in the dataview quickwatch that I
can update the underlying row. I could manually keep track of the index to
the datatable but if I could figure out how to update the table behind the dataGrid index of the view without a lot of looping, comparing, etc.
Hi Richard,
Yes, it should, but if you have any questions, send me some code and I'll be
glad to look at it.
Bernie
"Richard" <a@b.com> wrote in message
news:zu******** *********@twist er.nyc.rr.com.. . Now that I learned the current row index of the data grid corresponds to the DataRowView's copy of the bound data table's record, I think I can refine it with the copywt code below. I use a single table which is not in a dataset but I think it will still work.
"Bernie Yaeger" <be*****@cherwe llinc.com> wrote in message news:ur******** ********@TK2MSF TNGP10.phx.gbl. .. Hi Richard,
This isn't difficult. When you do a .find on a dataview, it returns the row index. The following syntax enables you to update that very row, without looping of any kind: If ifind <> -1 Then ' ie, found it
dsprod.Tables(0 ).Rows(ifind)(" copywt") = "abcd"
dsprod.Tables(0 ).Rows(ifind)(" onsaledt") = CDate("05/10/2003")
End If
HTH,
Bernie Yaeger "Richard" <a@b.com> wrote in message news:NF******** **********@twis ter.nyc.rr.com. .. > Windows Forms, csharp, 20 rows in DataTable 14 shown in view after filter > applied. For any of the 14 how do I do the datarow or something else thing > to access the data in the row of the table behind the view selected on the > datagrid. > > DataGrid only gives an index based on the 1-14 visible on the datagrid and > I > can't seem to update anything I see in the dataview quickwatch that I can > update the underlying row. I could manually keep track of the index to the > datatable but if I could figure out how to update the table behind the > dataGrid index of the view without a lot of looping, comparing, etc. > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: jwedel_stolo |
last post by:
Hi
I'm creating a dataview "on the fly" in order to sort some data prior to writing out the information to a MS SQL table
I have used two methods in order to determine the sort order of the DataView. (I'm writing in C# with the v1.1.4322 of the .NET Framework, in Window2K server"). First of all, here are the two methods I have used in order to apply the sorting property to the DataView
1. Simply defining the sort order and colum
DataView...
|
by: Brian Bischof |
last post by:
I'm using a third-party tool that takes a DataTable as a parameter. I really
need to pass it a DataView instead. When I try to explicitly cast the
DataView as a DataTable I get an error that they aren't compatible data
types. Does anyone have a suggestion on how to do this?
My last resort is to create a new DataTable object and copy the rows from
the DataView into the DataTable. But this is an ugly hack and I really hope
there is a...
|
by: Ed_P. |
last post by:
Hello,
I have a situation that I wish some help with. I have a DataSet object with DataTables populated from a ms access database. Each DataTable has a RunLogTitle. I have a TreeView object with TreeNodes that correspods to the Names of each DataTable's RunLogTitle. When the user clicks on a TreeNode the corresponding DataTable shows up in the DataGrid.
This is working great, but I would want to use a DataView object to show only the...
|
by: Richard |
last post by:
Windows Forms, csharp, 20 rows in DataTable 14 shown in view after filter
applied. For any of the 14 how do I do the datarow or something else thing
to access the data in the row of the table behind the view selected on the
datagrid.
DataGrid only gives an index based on the 1-14 visible on the datagrid and I
can't seem to update anything I see in the dataview quickwatch that I can
update the underlying row. I could manually keep track...
|
by: Mark |
last post by:
Hi all, quick question , a DataView is
memory resident "view" of data in a data table therefore once populated you
can close the connection to the database. Garbage collection can then be
used to "clean up" the DataView once it is not referenced and will not
effect the number of connections to the database.
A DataReader on the other hand always maintains a connection to the database
and must be explicitly closed (Do not rely on garbage...
| |
by: Dave Hagerich |
last post by:
I'm using a DataGrid with a DataSet and I'm trying to filter the data being
displayed, using the following code as a test:
DataView theView = new DataView(theDataSet.Tables);
theView.RowFilter = "'Record ID' = '0'";
theView.RowStateFilter = DataViewRowState.ModifiedCurrent;
Debug.WriteLine(string.Format("RowFilter = {0}", theView.RowFilter));
RecordDataGrid.DataSource = theView;
RecordDataGrid.DataBind();
|
by: kjvt |
last post by:
Based on a prior posting, I've written a function to convert a
recordset to a dataview. The first call to the function for a given
recordset works perfectly, but the second call always returns a
dataview with a count = 0. Can someone explain why and how I might
work around this problem?
Here is the code for my function:
Public Shared Function GetViewFromRS(ByVal pRS As ADODB.Recordset) _
As DataView
|
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...
|
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,...
|
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...
|
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...
| |
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,...
|
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...
|
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...
|
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...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |