|
No no no.
I want the FORM to automatically select the text when the control receives focus.
I probably can select text from inside my program with a statement, but that's not the point.
Plus...I have over 20 RichTextBox controls on this form and I want them ALL to behave the same way. If I have to go through and add all kinds of OnReceiveFocus() Handlers and Select(0, TextLength); statements then I'll be here all day.
My point is, according to MSDN, that's what AutoWordSelection is supposed to do. Does anyone know why it doesn't do it and how to correct it?
Phil
|
|
|
|
|
Phil C wrote: My point is, according to MSDN, that's what AutoWordSelection is supposed to do. Does anyone know why it doesn't do it and how to correct it?
I think you understand it incorrectly. You actually need to select part of the word to select the whole one. Recheck the documentation.
|
|
|
|
|
Hmmm, well you are right, I guess I did misread what ths property was for.
However, setting this property to true still has no effect. I have two controls on a form side by side. One with autoword select = true and one with autoselect=false.
As far as I can tell both controls behave the exact same way. I can select a single letter, a couple letters, or the entire word with my mouse.
But as usual I'm getting distracted from the goal I was tyring to achieve which was selecting the text as soon as the control gain focus. It's just frustrating when you try and experiment and various properties seem to have no effect.
About the only thing I can conclude is perhaps if the RichTextBox is stretched out and contains a sentence rather than a single word it works. I don't know *sigh*
|
|
|
|
|
this is my function and it works in Asp 1.1:
function thisFunctionInUserControl(obj)
{
switch(obj){
case 1:
if(eval("chkAdmin.checked")){
eval("chkStudent.checked=false;")
eval("chkProf.checked=false;")
}
case 2:
if(eval("chkProf.checked")){
eval("chkStudent.checked=false;")
eval("chkAdmin.checked=false;")
case 3:
if(eval("chkStudent.checked")){
eval("chkAdmin.checked=false;")
eval("chkProf.checked=false;")
}
}
}
I use it like this:
..
|
|
|
|
|
Hi everybody!
I have the next code and I’m having a problem with the DataRow:
DataTable dt = new DataTable();
dt.Load(GetReader());
dataGridView.DataSource = dt;
DataRow[]originalRows = dt.Select();
The problem is that when I change a cell value in the datagridview the change is also set in the originalRows values. I’d like to avoid this, since I want to use the original values of the datatable to compare them later to see whether there ware changes in my datagridview.
Thanks in advance,
Elvia
PS: Windows application in Microsoft Visual C# 2005
|
|
|
|
|
I forgot to say that I tried the following but it didn't work:
private void dataGridView_CellBeginEdit(object sender, DataGridViewCellCancelEventArgs e)
{
originalRows[e.RowIndex].CancelEdit();
originalRows[e.RowIndex].EndEdit();
}
|
|
|
|
|
Look into using DataSet rather than DataTable directly for loading and as DataSource
"What classes are you using ? You shouldn't call stuff if you have no idea what it does" Christian Graus in the C# forum
led mike
|
|
|
|
|
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
|
|
|
|