|
You're trying to solve this problem the wrong way. The Select method of the DataTable returns references to the rows in the table, not clones. When a value in a row is changed via the grid, the corresponding row in the table (and, hence, an element in your originalRows array) will reflect that change.
If all that you need to do is detect if values in the table have been modified, you can loop over every row in the table and check the RowState property.
Josh
|
|
|
|
|
Thanks Led and Josh,
I want to compare an specific cell not the whole row. I have the following comparation.
if (!originalRows[i]["Path"].Equals(testCase["Path"]))
Do you know how can I compare the cell's state?
I'll try the DataSet later and I'll tell you the results.
Elvia
|
|
|
|
|
You can call Copy on the DataTable, instead of Select, to get a complete and separate copy of the entire table. Later, when you want to compare each value in each row, you can just compare the copied (unmodified) table to the one bound to the grid.
Josh
-- modified at 15:04 Friday 5th May, 2006
You might also be able to use the overload of the Select method which takes the DataViewRowState parameter. It allows you to get the original values for modified rows.
|
|
|
|
|
Hi Josh!
Thanks a lot. I called the Copy method and did what you told me. It works as I want.
I appreciate it
Elvia
|
|
|
|
|
Hello all,
I've written an application that utilizes the code in "Customized display of collection data in a PropertyGrid" by Gerd Klevesaat. I've even managed to get the customized display of items in a collection working using a generic collection inheriting from BindingList<t>. However, I need a way to force the property grid to update at arbitrary times. Any idea how to make this happen?
I know about RefreshProperties(RefreshProperties.Repaint), but this attribute only tells the property descriptor to redraw the property grid contents when the value of the collection property changes, not when the contents of the collection change. Since I have events that are being raised when my collection changes (and have written a custom ITypeDescriptor class to handle interaction with the property grid), is there any way through ICustomTypeDescriptor where I can send a message to the property grid to refresh itself? My other option is to call the Refresh method on the property grid, but I'm not sure if it will actually change the contents. A final option is to set the SelectedObject on the property grid and cause it to refresh (I don't like this, since it is a bit too hackish for me).
Any ideas?
Thanks,
Will
|
|
|
|
|
Although I havent done this myself, you should be able to register to events in the property's PropertyDescriptor. Specifically, PropertyDescriptor.AddValueChanged(Object, EventHandler) . If you get it working via this, can you let me know? Thanks
|
|
|
|
|
I ended up doing it the lazy way. I just propagated an event back up the object heirarchy. The form receives that event from the root object and calls refresh on the property grid if the sender parameter (which is passed up from the object that raised the event) is a child of the object currently selected in the property grid. I did it this way since I already had functionality for determining whether or not a particular object contained another object.
|
|
|
|
|
I add COM+ component(macromedia flash ) in toolbox
but the problem is that it's not activated?
Thanks
Rastgar
Thanks
Rastgar
|
|
|
|
|
What do you mean by "not activated"? Is it grayed out?
What type of environment are you running it in? Windows or web?
|
|
|
|
|
it is a windows application and is developed by visual studio 2003.
by not activate, i mean, i cant drag and drop to my form. and i can not use it...
is every thing ok?
Thanks
Rastgar
|
|
|
|
|
You may need to run:
regsvr32 dllname
Geo
|
|
|
|
|
Hello,
This is my code which will convert the ADO resultset to XML in C#.
I actually need the column type, column max length etc also in the xml, like the column type/length of id, loginuserid, deptid, wrkstnid etc.
So I am not sure whether I need to pass some parameters to SqlDataAdapter class while executing the SQL command or the XmlDataDocument class has some methods which would print out the datatype and column length information in the XML. Looked at both the classes, didnt find any method, anybody has any ideas about this? Thanks
DataSet ds = new DataSet();
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
adapter.Fill(ds);
if (ds.Tables.Count>0)
{
_sBody = new StringBuilder("", _bodySize);
//Get xml representation of the dataset
XmlDataDocument srcXML = new XmlDataDocument(ds);
srcXML.Save("c:\\XMLDocument.xml");
....
}
<NewDataSet>
<Table>
<id>1</id>
<LoginUserId>tpmadmin</LoginUserId>
<DeptId>1</DeptId>
<WrkstnId>1</WrkstnId>
</Table>
<Table>
<id>2</id>
<LoginUserId>sysadmin</LoginUserId>
<DeptId>2</DeptId>
<WrkstnId>2</WrkstnId>
</Table>
</NewDataSet>
-- modified at 12:25 Friday 5th May, 2006
|
|
|
|
|
Try this, (with 'ds' being your dataset)
ds.WriteXml(@"c:\thedataset.xml",System.Data.XmlWriteMode.WriteSchema) ;
That will write out all your xml with the schema.
|
|
|
|
|
Okay, I actually want the max size of the column and I think that information is missing in the XML. The XML looks something like this. Max size of the column is used by the XSL to print the data. For datatypes like int, numeric, datetime I can manage the column lenght, problem arises only when its of type string, char etc
It has the column name, type, minOccurs. I think the max size of the column is missing, do I need to try some other method, or any other argument? Thanks,
<?xml version="1.0" standalone="yes"?>
<NewDataSet>
<xs:schema id="NewDataSet" xmlns="" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="NewDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Table">
<xs:complexType>
<xs:sequence>
<xs:element name="id" type="xs:int" minOccurs="0" />
<xs:element name="LoginUserId" type="xs:string" minOccurs="0" />
-- modified at 16:24 Friday 5th May, 2006
|
|
|
|
|
I'm adding items to a listbox, and want to keep the most recently added (bottom) items visible, but with nothing selected. I'm currently doing it my selecting the last item and immediately clearing the selection, occasionally the two operations happen on oposite sides of a screen refresh and the blue bar flickers momentarily. Is there a better way to do this?
lb.SelectedIndex = lb.Items.Count -1;<br />
lb.SelectedIndex = -1;
|
|
|
|
|
This should be what you need:
this.listBox1.TopIndex = this.listBox1.Items.Add( "FOO!" );
Josh
|
|
|
|
|
Thanks. That property could be named better though, looking at it I'd assume it was an alias for the first element in the list, and not something to control what elements were visible.
|
|
|
|
|
At least it works
|
|
|
|
|
I need a method of capturing as a gif the screen on a WM5.0 device using C#, VS2005. I have done the capture as a bmp however it is very large in size (!40K). I need to be able to send the image over a cell network that charges by the byte so I need a small image.
If there is a tool to convert bmp to gif on the mobile device that would also work for me.
Thanks,
Nick Price
nickprice@canada.com
|
|
|
|
|
In Compact Framework 2.0 you can save a bitmap in different file formats.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa,
Thanks for the response. I'll bet this is an easy process. However, between my thick head and relative newness to C# I have not been able to figure it out and I have been trying for several weeks now.
A few more details, pointers, clues etc would be most helpful!
nickprice@canada.com
|
|
|
|
|
Look at the Bitmap.Save(string, ImageFormat) or Bitmap.Save(Stream, ImageFormat) methods.
---
b { font-weight: normal; }
|
|
|
|
|
Bitmap.Save is not supported in the Compact Framework
|
|
|
|
|
As I wrote in my forst post, it's supported in compact framework 2.0.
---
b { font-weight: normal; }
|
|
|
|
|
When I try to add Bitmap the only options I get are Equals, FromHbitmap and ReferenceEquals.
I have added 'using System.Drawing' and have added a reference to it. Am I still missing a reference?
|
|
|
|