|
hi...
my problem is... that I have some rtf text without Rtf headers. For example: "hell\\`b1".
The plain text should be "Helló".
Is there a quick way to do this translation (rtf to plain)?
I know, there is a way to do it...but it is complex.
thanks
|
|
|
|
|
read it in a text box
"Not everything that counts can be counted..."
-Albert Einstein
|
|
|
|
|
Hi!
You could try adding a minimal RTF header yourself:
string rtf = @"{\rtf1\ansi"+myRtfFragment+"}";
richTextBox1.Rtf = rtf;
MessageBox.Show("Plain text is '"+richTextBox1.Text+"'");
Regards,
mav
|
|
|
|
|
How can I add days to a rowfilter column?
I want to add 30 days to ExpirationDate which is a column name in the dataview. dt is current date. In a nutshell, expirationdate + 30 days >= current date
Please help!
dv.RowFilter = "ProducerNameCode = '" + agentCode +"' AND ExpirationDate >= '" + dt +"'";
|
|
|
|
|
|
this is what i whant to do
private void Form1_Load(object sender, EventArgs e)
{
Test(CLLER);
Test(Bob);
}
private void Test(?????? t)
{
//t should be the sub i want to call! so how would i do this?
t("Test");
}
private void CLLER(string T)
{
MessageBox.Show(T);
}
private void Bob(string T)
{
this.Text = T;
}
thanks
codegreen
-- modified at 19:52 Thursday 17th November, 2005
|
|
|
|
|
I think you have the wrong impression of method overloading. Why not just do
..In the form load event
{
Test(CLLER); <<-- Assuming these are string objects
Test(Bob); <<-- Assuming these are string objects
}
void Test(string T)
{
if(String.Compare(T,"CLLER")== 0)
{
MessageBox.Show(T);
}
else
{
this.Text = T;
}
|
|
|
|
|
because i have a more complex code
public void CheckCrossThread(string data, string scase)
{
//DataReceived(this, data);
if (((System.Windows.Forms.Form)_Form).InvokeRequired)
{
SetTextCallback d = new SetTextCallback(CheckCrossThread);
((System.Windows.Forms.Form)_Form).Invoke(d, new Object[] { data,scase });
}
else
{
switch (scase)
{
case "DataReceived":
DataReceived(this, data);
break;
case "Disconnected":
Disconnected(this);
break;
case "TCPError":
TCPError(this, new Exception(data));
break;
default:
TCPError(this, new Exception("Not Found")); ;
break;
}
}
I use this for most of my projects but its hard to keep editing it over and over again. i would like (scase) to call the sub it was passed
thanks
codegreen
|
|
|
|
|
Take a look at the "delegate" keyword.
|
|
|
|
|
Instead of having to do a switch and determine which method to execute based on the string value, I'd recommend passing some delegate that contains the code to execute. For example, using C# 2, if I wanted CheckCrossThread to execute DataReceived method, I could do:
this.CheckCrossThread("someData", "DataReceived", (System.Threading.ThreadStart)delegate{ DataReceived(this, "someData") });
public void CheckCrossThread(string data, string scase, ThreadStart methodToExecute)
{
...
methodToExecute();
}
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
that is what i need thanks, BUT C# doesn't like
this.CheckCrossThread("someData", "DataReceived", (System.Threading.ThreadStart)delegate{ DataReceived(this, "someData") });
it says } needs ;
I fix that but it needs a method the DataReceived is and event
-- modified at 18:01 Friday 18th November, 2005
|
|
|
|
|
It can be done using reflection, but it is probably a little slow, so use it sparingly:
<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
Test("CLLER");<br />
Test("Bob");<br />
}<br />
private void Test(string t)<br />
{<br />
GetType().InvokeMember(t, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.InvokeMethod, null, this, new object[] {"Test"});<br />
}<br />
private void CLLER(string T)<br />
{<br />
MessageBox.Show(T);<br />
}<br />
private void Bob(string T)<br />
{<br />
this.Text = T;<br />
}<br />
}<br />
Check out the documentation for InvokeMember, for more information.
-----
In the land of the blind, the one eyed man is king.
|
|
|
|
|
I have code to call a DLL that I wrote in C (see end of message). This code has worked fine for months. I reloaded my OS and installed a fresh vs2005 rc and now I'm getting a System.DllNotFoundException. It also says: Unable to load DLL 'copy.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
My DLL is in my working directory just as it was before. My project setup has not changed and the working directory is specified correctly. What could have changed to cause this error?
[DllImport( "copy.dll", CharSet = CharSet.Unicode )]<br />
public static extern int BackupClose( long hash1, long hash2 );<br />
|
|
|
|
|
Hello everybody. I downloaded de VC# 8 Express. While it works well, I'm having a problem with the doc compiler. I do my comment stuff:
<br />
interface IProperty<br />
{ ... }<br />
And when I compile it, it generates me the XML output file. So far so good. However, I cannot find a tool that actually builds the documentation as in VC# 7. So my question is: is there available any tool that allows me to document C# 2 code (and I mean, human-readable documentation), or is there any integrated tool with VC# 8 Express?
Thanks a lot.
...it's not right in one life, too much rain...
|
|
|
|
|
I need to query ADAM from .net code. Could someone please point me in the right direction?
Thanks
|
|
|
|
|
And which reference to "ADAM" would you be referring to?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I was referring to 'Active Directory Application Mode'
|
|
|
|
|
Try searching MSDN for "C# ADAM". You'll find a bunch of examples.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
this code gives the error "A local variable named 'var' cannot be declared in this scope because it would give a different meaning to 'var', which is already used in a 'parent or current' scope to denote something else".
I don't see why it should be a problem, the 1st i is out of scope before the 2nd one is created.
<br />
int[] intarray = new int[10];<br />
foreach (int i in intarray)<br />
{<br />
i++;<br />
}<br />
int i = 5;
|
|
|
|
|
The first 'i' is not out of scope of the second i. When a variable is declared in a foreach/for loop it is the same as the following.
int i;
for ( i=0; i++; i<5 )
{
}
The scope of the variable is outside of the loop.
|
|
|
|
|
You're not allowed to do this:
int i = 5;
if (x==0)
{
int i = 7;
}
because the second one 'hides' the first. The compiler isn't smart enough to let you define a second i after the one in a loop, it just works out that you have one in an inner scope, and one in an outer scope. If you put the int i = 5; inside another scope, so that there was no chance of it to flow down, then the compiler would be fine.
Something like this
int i = 0;
for(;i
|
|
|
|
|
P.S. why is this site so hard to use ? I've tried to post this three times and got three different error messages.
Yeah, the server is down quite often lately. Either it's a "Service unavailable", "500 error" or I can't even connect to codeproject.com at all
modified 12-Sep-18 21:01pm.
|
|
|
|
|
The load balancing portion of CodeProject isn't working properly at the moment. Chris is working on the issue...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
CG, use secure.codeproject.com for now. Much more performant and zero timeout errors.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Bought a House!
Judah Himango
|
|
|
|
|
Cool - thanks for the tip. I was expecting you to have explained why my answer was wrong :P
Christian Graus - Microsoft MVP - C++
|
|
|
|