|
Pete O'Hanlon wrote: use some form of whiteout on the screen whenever he makes a mistake
Ah, yes, that's always the classic solution
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
|
yes i have already seen that article but i didnt type my text as html on word document. I found this
object pasteType = Word.WdPasteDataType.wdPasteHTML;
range.PasteSpecial(ref oMissing, ref oMissing, ref oMissing, ref oMissing, ref pasteType ,ref oMissing, ref oMissing); but it gives me an error says {"The specified data type is unavailable."}
thanks for everything i have...
|
|
|
|
|
I found the solution, maybe somebody need it...
to write as html on c# first take clipboard as html then use stringbuilder
Object m = System.Reflection.Missing.Value;
DataObject clipDO = new DataObject();
clipDO.SetData(DataFormats.Html, HtmlClipboardData(strHTML));
Clipboard.SetDataObject(clipDO, true); // Save to clipbaord
object typeHtml = (object)Word.WdPasteDataType.wdPasteHTML;
s.PasteSpecial(ref m, ref m, ref m, ref m, ref typeHtml, ref m, ref m);
http://www.codeproject.com/script/Membership/Profiles.aspx?mid=252028
knowledge is valuable when it is shared !!!)
and nobody has a right to make fun with anyone!!
thx all
thanks for everything i have...
|
|
|
|
|
Hi TALHAKOSEN,
I know it's been 2 years on this stream, But is there any chance that you can tell me what's HtmlClipboardData(strHTML)?
Thanks for sharing your knowledge.
N
|
|
|
|
|
hi,
How can I send and receive data from clipboard to a COM port?
Best wishes
|
|
|
|
|
For sending and receiving data from COM port there is a SerialPort class. For clipboard manipulation you can use Clipboard class.
|
|
|
|
|
Hello there,
I wanna to create an application that transfer data between two computer over the internet. Can any body help me?
Please give a web link of a sample, if there is any things.
|
|
|
|
|
Majid_grok wrote: I wanna to create an application that transfer data between two computer over the internet
Good for you. Please let us know how that turns out for you.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
heh heh ...
|
|
|
|
|
I just assumed the "is urgent"
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
|
|
|
|
|
Not necessarily so easy situation:
Majid_grok wrote: Please give a web link of a sample, if there is any things
This would require 'an application that transfer data between two computer over the internet'.
The need to optimize rises from a bad design.
My articles[ ^]
|
|
|
|
|
Hey, Don't bother Iranian guys!
Kiddin
Hi Majid, How are you?
I think you should use .Net Remoting[^]. You can create a Tcp Server (on your computer) and a Tcp Client (on a computer thousands of miles apart) and send your data using a class that inherited from MarshalByRefObject. I have a clear sample here[^] (you should use your server IP instead of "localhost").
Hope Help Hou (Oops, You )
While (true) { Human.isLearnable = true; }
|
|
|
|
|
Try Google for FTP - it does the job a treat
Bob
Ashfield Consultants Ltd
|
|
|
|
|
Hi All,
I was recently talking to a colleague at work and the topic came round to using swith(). He said that he'd read/heard more than once that if you find yourself using a switch you can more or less be assured that its because you've done something wrong in your architecture elsewhere.
What do other folks think of this?
Cheers,
|
|
|
|
|
Err, being polite, I don't agree. What if you had an enumaration of states and had to execute a different peice of code depending on the current state? You'd have two main choices a bunch of if/else's or a switch. Switch is a little neater and makes more sense so you'd use that.
Of course it greatly depends on the situation, but there's absolutely nothing wrong with a switch block.
My current favourite word is: Nipple!
-SK Genius
Game Programming articles start - here[ ^]-
|
|
|
|
|
I agree, I just thought I'd post this here to see what people think since I was just writing a switch statement and the conversation popped back into my head.
I've used a switch in a couple of places in my current project and I think its perfectly valid where I've used it. I was just wondering what the general consensus is on CP.
I'm not a great fan of massive if/else's, they look ugly and are harder to read 9 time out of 10.
|
|
|
|
|
A switch statement looks like an ugly hack, and some purists feel it is, but there are times when it makes more sense to use a switch than to have to write 4000 lines of plumbing code just to avoid it. It's like everything else in C# - use it when you have to.
|
|
|
|
|
|
Pete O'Hanlon wrote: It's like everything else in C# - use it when you have to.
Couldn't agree more. I have heard the "using construct X is really bad design" about more or less every construct in C/C++/C#, but they all have situations where they are just right, so use them where they make sense. (yes... even "goto"...)
ASCII tables, HTML entities, types, string formats and more info for the serious coder at: www.codecharts.com
|
|
|
|
|
Jammer wrote: if you find yourself using a switch you can more or less be assured that its because you've done something wrong in your architecture
That makes so much sense considering it's been around since C
and the C# founders decided to include it in C# just
for bad software architects to use...yeah...
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Heh heh ... to be fair, I've been learning C# since February and it wouldn't be the first time that I've come across something in the language and other more experienced folks have said to me "oooh ... you really don't want to use that ... that's bad" or similar.
And like everything there is more than one way to skin a cat. I'm sure I could design out the need for the switch statements I've used so far if I really wanted too ...
|
|
|
|
|
IMO it comes down to the resulting compiled code.
The ability of a computer to branch based on a decision is
powerful, and taken for granted these days.
So, when designing a high level language, where you want the
ability to branch based on a list of comparisons, what are the
alternatives? One can do it explicitly with if/then/else but that
can be inefficient for the decision at the end of a big list.
To avoid that inefficiency some kind of look-up table may be more efficient.
Theoretically, using the switch semantics, a good compiler could
recognize a big list and produce more efficient branching code - possibly
using a look-up table of some kind. The restrictions of the switch statement
allows this.
Here's a C++ example ( completely OT for this forum, but demonstrates my point):
int i = 6;
if (i == 0)
TRACE0("0");
else if (i == 1)
TRACE0("1");
else if (i == 2)
TRACE0("2");
else if (i == 3)
TRACE0("3");
else if (i == 4)
TRACE0("4");
else if (i == 5)
TRACE0("5");
else if (i == 6)
TRACE0("6");
else
TRACE0("n");
switch (i)
{
case 0:
TRACE0("0");
break;
case 1:
TRACE0("1");
break;
case 2:
TRACE0("2");
break;
case 3:
TRACE0("3");
break;
case 4:
TRACE0("4");
break;
case 5:
TRACE0("5");
break;
case 6:
TRACE0("6");
break;
default:
TRACE0("n");
break;
}
The resulting if/else machine code does six comparisons to get
to the resulting branch.
The resulting switch machine code does one comparison to see if
i is > 6, and if it isn't, branches directly to the correct case
using only TWO machine code instructions (via a look-up table)
0041D9F5 mov ecx,dword ptr [ebp-0AE4h]
0041D9FB jmp dword ptr (41F8CCh)[ecx*4]
switch may be ugly in source code, but the compiler can certainly
take advantage of it to produce efficient code.
And I don't buy the "purist programmer" arguments...what purist would
use C# (or any other higher level language)?
It still all comes down to knowing the language you're using and
choosing the right instructions for the given situation...
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Great example! Thanks for this ...
|
|
|
|
|
Heh no problem. I work alone at home - I don't get to
have these water-cooler discussions with colleagues
Cheers!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|