|
Hello,
I just performed 8 searches on CodeProject for "Rich TextBox Ruler" because I want to add a ruler to my text editor project and, I also changed the search phrase around but it kept on showing "No results" page but the other day there were heaps... Does anybody know how I can add a ruler to my text editor project, or know any links for articles?
Thanks all,
jason
|
|
|
|
|
How about this[^] one?
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
a metric ruler?
the EU will only go that far.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
hehehe, I'm not sure of the correct name for it, but I'd like the same type of "ruler" as you would see in Microsoft Word, for example.
Jase.
|
|
|
|
|
Hi
http://www.codeproject.com/KB/miscctrl/ruler.aspx
This might help u
|
|
|
|
|
Thank you both for your links. Just what I was looking for. I'm very happy!
Jase.
P.S. Maybe I need to reset my cache... I don't know why searches are not returning any results.
|
|
|
|
|
Can anyone explain why the following won't compile and a possible solution...
string strSequence = (view.GetFocusedValue().ToString() == String.IsNullOrEmpty ? view.GetFocusedValue().ToString() : "");
I get the following error...
Error 16 Operator '==' cannot be applied to operands of type 'string' and 'method group'.
Many Thanks
|
|
|
|
|
String.IsNullOrEmpty is a method, not a property. Try to use this instead:
string strSequence = (string.IsNullOrEmpty(view.GetFocusedValue().ToString()) ? view.GetFocusedValue().ToString() : string.Empty);
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
|
.IsNullOrEmpty is a method
change to .Empty
|
|
|
|
|
stancrm wrote: change to .Empty
Trust me, having if conditions that change variable contents is a good way to really mess your code up and cause such nasty bugs! I don't think Empty() does quite what you think it does...
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
string.Empty doesn't change the value of the string unless you assign it, and the OP was doing an equality test. What do you think it does?
If his test is if (value == string.Empty) , this doesn't change value .
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
ms fxcop says:
dont use : (value == string.Empty)
use: (value.Length == 0)
|
|
|
|
|
Indeed, but that's for a separate issue (i.e. it's quicker to check the length). The fuller check is to use string.IsNullOrEmpty to check because the value might be null or it might be empty, in which case value.Length would throw an ArgumentNullException .
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
Pete O'Hanlon wrote: string.Empty doesn't change the value of the string unless you assign
You are absolutely right, and I grovel, lots. I can only blame complete and utter brain failure, brought on by unexpected sunshine.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Ok wait, what are you trying to achieve? This code (even if I pretend that the == works) does not do anything useful.
Suppose view is null: NullReferenceException
Or the value returned by GetFocusedValue is null: NullReferenceException
Or the value returned by ToString is null: strSequence is null
ToString returns "": strSequence is ""
ToString returns anything else: strSequence is ""
So you either get an exception, or you get a useless value in strSequence. What's the deal here? What did you want to do?
If what you want is: the value of view.GetFocusedValue().ToString() if it isn't null, or "" if it is null
Then you could do:
string strSequence = view.GetFocusedValue().ToString() ?? "";
Disclaimer: I just woke up, it's entirely possible that I'm not making any sense at all - sorry!
|
|
|
|
|
Harold, Thanks for that - I think that is exactly what I need. Basically all I want to do is check if View.GetFocusedValue... is null. If it is null then assign a "" otherwise use the View.GetFocusedValue. What will happen with it if the value comming back happens to be DBNull.Value (assuming I was doing something with a dataset.
Thanks
|
|
|
|
|
With the code I suggested you could still get a nasty NullRef, but how about
var FocusVal = view.GetFocusedValue();
string strSequence = "";
if (FocusVal != null)
strSequence = FocusVal.ToString();
Alternatively:
string strSequence = (view.GetFocusedValue() != null) ? view.GetFocusedValue().ToString() : "";
Would call GetFocusedValue twice though so only use if that's ok.
Or if GetFocusedValue returns a string:
string strSequence = view.GetFocusValue() ?? "";
edit: oh I missed the DBNull thing, well that might change things in ways unknown to me - I've never used database code..
|
|
|
|
|
Hello Experts
i am facing one problem regarding data source of crystal report.when i switched to another server then data source location cant change automatically,i have to update it.
tel me solution for this.i.e.when server changes data source location also changed.
|
|
|
|
|
KIDYA wrote: tel me solution
Call Crystal, it is there problem!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Didnt get what r u trying to say?Be specified.
|
|
|
|
|
Engage your cranium.
This has nothing to do with C# and everything to do with Crystal Reports.
Ask them, not us!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
I have to read a file, search for a special character 'ç', its ascii equivalent is 0231 (c-cedilla) and replace it with a space. I have tried File class's ReadAllBytes / ReadAllText / ReadAllLines with Encoding.ASCII to read the file, but when it comes to this special character, it reads as '?' whose ascii equivalent is 63.
How to do this?
Any kind of help will be appreciated.
Thanks in advance
harry
|
|
|
|
|
the file format is probably unicode. just find the byte, then replace it with "space"-byte.
|
|
|
|
|
maybe/maybe not. The file format is probably ascii, just not in the right codepage. Unicode should not have any problem.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|