|
Hi everybody,
I'm trying to make the bindingnavigator work but I could not find documentation or examples. I want to bind the bindingnavigator to the rows of my datagridview. If this might not be possible via databinding an example of another way would be more than welcome.
Loads of thanks for your assistance,
Elvia
|
|
|
|
|
Bind the grid and the bindingnavigator to a BindingSource component. The BindingSource orchestrates the binding for all things bound to it. Check out this article[^] to see an example.
Josh
|
|
|
|
|
That was what I needed. I already solved it.
Thanks a lot Josh!
Elvia
|
|
|
|
|
Hello,
If I have a label in the edit mode, and the user makes a text selection, is there a way to capture the selected text only. There is an attribute on the text box that does that.
Thank you
|
|
|
|
|
There are a couple of problems here.
1) As far as I know (and I could be wrong) there is no way to get a reference to the edit window hosted by a node in edit mode. If that is the case, then getting the selected text in a node's label is not possible, at least not via the edit window (aka text box).
2) What event(s) would be used to determine when to grab the selected text? What would trigger the logic to get the selected text in the node's label, when the mouse moves or clicks? when a key is pressed? etc.
BTW - the TextBox class offers the SelectedText, SelectionStart and SelectionLength properties, which can be used to get/set the selected text in the control.
Josh
|
|
|
|
|
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();
|
|
|
|