|
I am dealing with the TreeView, and TreeNodes, so TextBox is not an option.
Thank you for your reply
|
|
|
|
|
Oh, I misunderstood your question. Sorry about that!
However, point (1) of my original response still applies. The TreeView does not expose a reference to the edit window used by nodes. Also, it does not expose a property similar to the SelectedText property of the TextBox.
HTH
Josh
-- modified at 13:51 Wednesday 10th May, 2006
Actually, point (2) of my original response still applies as well. I guess I did understand the question. What you could do, if you really need to know the selected text, is have the user edit a node's text in a TextBox control elsewhere on the Form. That would allow you to have fine-grained control over the editing process. The TreeNode class exposes the BeginEdit and EndEdit methods which provide programmatic control over edit sessions.
|
|
|
|
|
|
Hi
I've got an XML file that has a namespace set which is constant throughout the document.
I've used an XmlNamespaceManager to add an alias for the namespace that I can use in the XPath queries. Currently I have to add the namespace to every part of the XPath query (eg. /ns:foo/ns:bar/ns:wibble/@attrib).
Is there a way to set the default namespace (the nsManager.DefaultNamespace currently says '') so that my XPath query would then just be /foo/bar/wibble/@attrib?
|
|
|
|
|
Not as far as I know, I have come across this issue too. You write a little utility function to convert that to the "namespaced" mode (string.Split('/') ).
|
|
|
|
|
Is it possible to do something like the following?
class x
{
public x(string y)
{
if ( y == "" )
else
}
}
I can just throw an exception, but I would like the program to continue running, if possible, without try/catch statements...
|
|
|
|
|
You can throw an exception in the constructor to prevent the object from created. Other than that, no, there is no way to evade instantiation from within a constructor.
Josh
|
|
|
|
|
Damn that was fast!!
I've just finished editing my post and BAM! A reply!
Well... Thank you very much...
Shy.
|
|
|
|
|
One way you could do something like that might be to have a static method in your class and use that to instantiate your class (or not). Something like this:
public static MyClass GetMyClass(string y)
{
if (y != "")
return new MyClass();
else
return null;
}
I *think* that if you have a private constructor and you put the public static method in the same class you'll still be able to instantiate through the static method but won't be able to do it directly which I think give you what you need.
|
|
|
|
|
Wjousts wrote: I *think* that if you have a private constructor and you put the public static method in the same class you'll still be able to instantiate through the static method but won't be able to do it directly
Yes, that is correct.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks...
|
|
|
|
|
I am using pInvoke to access an unmanaged DLL, which works fine, the Dll is loaded into memory by the run time as soon as I call an API therein.
However, the DLL loading process is transparent to me, so I don't have any guarantees as to its persistence in memory.
I'm thinking that I should call LoadLibrary myself to bump the reference count while I'm interacting with the Dll.
Thoughts?
NIK
PS. I don't suppose that there is any way I can indicate to the runtime that the DLL should be permamnently attached to my process.
|
|
|
|
|
I like the question! Actually that might be cause to worry
Anyway I don't beleive you have to worry about the system unloading your DLL on you if that is what you are wondering.
I think for managed modules you have to unload the appdomain to get a DLL to unload. There are MSDN articles about this, it actually is somewhat complicated to unload DLLs because of this.
"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
|
|
|
|
|
I am calling an in-house DLL, I just declare the API with DllImport and .NET takes care of the rest.
Good article on the basics of the P/Invoke subject here: http://msdn.microsoft.com/msdnmag/issues/03/07/NET
I did some testing and comfirmed that the DLL remains attached for the lifetime of the calling process. Makes sense in hindsight. Luckily I don't have any working set size problems yet that would require me to unload the DLL forcefully.
Know where I can get some info. on the low level machinations of P/Invoke, there are some things I would like to better understand about interop marshaling. I think I better post a separate question on the next subject.
Thanks for the response.
NIK
|
|
|
|
|
Hi all,
I have a program running without stop with a textfield to display data. I reset the textfield whenever its maxlength is reached.
The program ran well but one day I saw my computer was restarted and I looked at the application event and saw that it was caused by Running time in .Net .
I wonder if anyone knows this running time issue or a similar problem.
Thanks.
Kyah
|
|
|
|
|
I never had any issues regarding this. Could you post what exactly has been written to the events queue?
|
|
|
|
|
well, the code is not so complicated.
private void display(string data)
{
checklength(data.length);
txtdisplay.appendtext(data);
}
private void checklength(int num)
{
if((txtdisplay.text.length + num) > txtdisplay.maxlength)
txtdisplay.reset();
}
Anyone wants to test, creating a form with multiline textfield, just running a forever loop and passing a string to the display function.
Thanks.
Kyah
|
|
|
|
|
i have a login (username & password) textboxes on main form and if one succesfully logins to the form then i hide the main one and open another form (form2).
i want to show the first hided form if one clicks the (X) on the form2 ?
how can i do this ¿
|
|
|
|
|
Override OnClosed (or OnClosing if you want to do some checks first) in form2 and there you can do form1.Show().
Make sure that form2 has a way to reference form1 though.
|
|
|
|
|
Form1 f1 = new Form1();<br />
f1.Show();
|
|
|
|
|
I have a project where I need to serialize a class. The class contains a collection of objects. The collection is heterogenous but all the members derive from the same base class. To get it to serialize I have to explicitly define every possible class that could be a member of the array using XmlArrayItem. Like this:
[XmlArray]
[XmlArrayItem(typeof(MyBaseClass),ElementName="Base")]
[XmlArrayItem(typeof(MyDerivedClass1),ElementName="Derived1")]
[XmlArrayItem(typeof(MyDerivedClass2),ElementName="Derived2")]
[XmlArrayItem(typeof(MyDerivedClass3),ElementName="Derived3")]
public List<MyBaseClass> MyList;
My question is, is there an easier way to do this? It's really annoying when I add a new class and then have to wonder why the serialization has broken again and end up spending maybe 15 minutes trying to figure it out before I remember I forgot to add it as an XmlArrayItem.
|
|
|
|
|
Hi guyes,How Can I Fill A Combobox With SQl Server DataBases?
Thank You
Nour
|
|
|
|
|
Is there a way to get the currently displayed URL in the running instance of Firefox?
I could do that with Internet Explorer but have no clue on how to do it with Firefox.
Thanks.
|
|
|
|
|
hi all,
first i put a button on a form and click on the button to add some code in it (on click property).
then i decide to remove that button. but the source of that click property remains in form.cs file.
what should i do in order to clear everything related with a button or a label from that .cs file if i remove them ?
(do i have to remove them manually ???)
help please.
bye.
|
|
|
|
|
if you create a click event that means you create a new method, the method will stay there, but everything else (such as click event, the button himself) will be deleted, so all you got to do, is to erase the method.
|
|
|
|