|
I am using the ListView.SelectedIndexChanged to update data, when a new item has been selected.
My problem is, that the event will be fired for each new selected (de-selected) item (if multiSelect is true; more than twice). [And i don't want to get the data from the database each time.]
Is there an event that will be raised if the control has finished handling these processes (or processes for this control at all)?
Or does anyone have another idea to solve thsi problem
|
|
|
|
|
C-Scharbe wrote: Is there an event that will be raised if the control has finished ...
No.
The Control can not guess when you have finished selecting and de-selecting, so the only
thing it can do is fire every time. Either apply code that can stand this, or add some
way for the user to confirm the selection process is done, e.g. a button.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
It's too complicate...
... for the user to click an extra button
I missing something like LastSelectedIndexChanged or AfterSelectedIndexChanged.
|
|
|
|
|
It's too complicate...
... for the computer to read the user's mind
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Perhaps he could use classes from the DWIM namespace...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Unfortunately a lot of methods in System.DWIM throw a NotImplementedException.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
So there is minimum a
throw new Exception("The method or operation is not implemented.");
implemented !!
|
|
|
|
|
What is DWIM?
Tell me more
Or send me a link....
|
|
|
|
|
Here's[^] the documentation for the namespace...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Does anyone have an idea, to solve this problem??
|
|
|
|
|
Hello
I'm trying to bind a list to a combobow but without effective result
class Rue<br />
{<br />
public int Id;<br />
public string Nom;<br />
};<br />
<br />
List<Rue> Rues = new List<Rue>();
Then I'm trying to fill and bind that list to a Combo
<br />
Rues.Clear();<br />
readRues("1000",Rues);<br />
cmb_rues.DataSource = Rues;<br />
cmb_rues.DisplayMember = Rues[0].Nom;
The Combo displays things but not what I expect
It shows
App.Form+Rue
App.Form+Rue
App.Form+Rue
etc..
Thanks for any help !
|
|
|
|
|
I think you need to write:
cmb_rues.DataSource = Rues;<br />
cmb_rues.DisplayMember = "Nom";<br />
cmb_rues.ValueMember = "Id";
|
|
|
|
|
Hello
I've try it too !!
Same result BUT
If I declare the ValueMember I got a message cannot bind to the new displaymember
|
|
|
|
|
Try this:
class Rue<br />
{<br />
public int Id;<br />
public string Nom;<br />
<br />
public override string ToString()<br />
{<br />
return Nom;<br />
}<br />
};
|
|
|
|
|
Thank you
It works indeed !
But I really do not understand why and how ?
I'm old to C but new to csharp and oop
|
|
|
|
|
The combobox run ToString() for each item.
If you have a class, that does not override the ToString() method, it returns the name of the class- type.
I guess you don't need to run cmb_rues.DisplayMember = ... ??
|
|
|
|
|
I understand better now
Thank you !
|
|
|
|
|
Create properties for your members and let the display member be a property. It should work.
Let me know if it doesn't.
|
|
|
|
|
|
Can anybody help me in this? thank you in advance.
|
|
|
|
|
Hi,
this is a two-step process:
1. select the text that needs special handling; you can do that interactively, or programmatically; while it already is in place, or while adding.
2. choose a new font for the selected text (RichTextBox.SelectionFont Property) and use
FontStyle.Underline for it.
For all the details, read up on the RichTextBox and Font classes.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Thanks.
Well there's a problem. What if my selection includes multiple fonts? RichTextBox.SelectionFont Property returns null in that case. How can I underline my selection without changing the original fonts?
|
|
|
|
|
Hi,
if multiple styles are selected, the selection has to be split up into homogeneous
parts; select and underline each part in turn; then restore the original selection.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Thank you.
Your suggestion worked. I splitted my multi-font-selection into several homogeneous parts, selected each part and underlined them one after another. Finally I restored the original selection.
However, as I try out the program, it flickers.
|
|
|
|
|
SeeBees wrote: it flickers
sure, all Controls basically have that problem, and the more data they hold and the more
operations you perform on them, the more it shows.
Here are some suggestions to reduce the flickering, you pick and choose:
- optimize your code; tha faster it runs the less you will notice it;
- try using SuspendLayout() and ResumeLayout(); I'm not sure how well it helps with an RTB;
- difficult: get the Rtf property, operate on it (that's string operations now, not very
elegant), and when done, store it again
- alternative: have a second RTB, not visible, copy the Rtf from the first to the second,
operate on the second RTB, then copy back the Rtf. This should work nicely.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|