|
Are you sure your destructor is called?
It sounds like that on yoo, but the destructors in C# is not the same as C++' destructors. It's not a guarantee that C# destructors are called when an object is destroyed. I don't knwo why (have forgot it )
But this maybe wasn't big help to you, sorry!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
This code doesn't work for me:
String str = this.textBox1.Text;
String newStr = str.Trim();
MessageBox.Show(newStr);
The MessageBox that appears contain the string WITH all white spaces!!!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
Trim only removes leading and trailing whitespace. It doesnt remove the spaces between words etc. Is that what you mean?
--
David Wengier
Sonork ID: 100.14177 - Ch00k
|
|
|
|
|
hm.. what I understod from my book it was suppose to do that... but okay!
Thank ya!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
|
Nish - Native CPian wrote:
It worked for me
huh?
Well I can compile it... but I missunderstod the use of Trim(). I thought it was suppose to remove all white spaces in the string!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
I think what you're looking for is Replace.
<br />
String str = this.textBox1.Text;<br />
String newStr = str.Replace(" ", "");<br />
MessageBox.Show(newStr);<br />
Andy Gaskell, MCSD MCDBA
|
|
|
|
|
Quote frpm MSDN ( I suggest you use it )
String.Trim Method
Removes all occurrences of a set of specified characters from the beginning and end of this instance.
Overload List
Removes all occurrences of white space characters from the beginning and end of this instance.
<br />
public string Trim();<br />
Removes all occurrences of a set of characters specified in a Unicode character array from the beginning and end of this instance.
<br />
public string Trim(params char[]);<br />
IOW
<br />
String str = this.textBox1.Text;<br />
String newStr = str.Trim(' ');
MessageBox.Show(newStr);<br />
Hope this helps
|
|
|
|
|
Is there anything in C#.that is similar to Control ID's in MFC ?
VIKS
|
|
|
|
|
For what purpose? Without knowing what you wish to do its hard to know if an alternative exists.
James
|
|
|
|
|
Actually I have some MFC code. I don't want to write it down again in c#. That why I need this stuff.
VIKS
|
|
|
|
|
vikrams wrote:
I don't want to write it down again in c#.
If you don't want to write in C#, then why do you bother
..this is a VB Programmers' world and we all are just visitors - Someone in a MSJ article
|
|
|
|
|
As James said, it's hard to suggest something without knowing what you are trying to achieve, but perhaps you are looking for the Control.Name Property
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Actually I have some MFC routines (inside dll) that I want to use in c# UI .
VIKs
|
|
|
|
|
|
I am sorry. But I dont have any idea about P/Invoke . can you give little example?
VIKs
|
|
|
|
|
vikrams wrote:
But I dont have any idea about P/Invoke . can you give little example?
In my opinion P/Invoke is ugly and I recommend that you use MC++ and IJW.
Nish
p.s. Chk the Managed C++ sections for some related articles
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Sorry again but what is IJW?
VIKs
|
|
|
|
|
vikrams wrote:
Sorry again but what is IJW?
Read this article :-
http://www.codeproject.com/useritems/nishijw01.asp
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
Nish - Native CPian wrote:
I recommend that you use MC++
So... I can use MC++ in C#??
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
Rickard Andersson wrote:
So... I can use MC++ in C#??
I actually meant that you can use MC++ instead of C#.
Basically if you don't have GUI-intensive work you can use MC++.
Right now they don't have a form designer for MC++. When that comes out you can use MC++ for all your .NET coding. That way you can use your old MFC/ATL code as well as new managed code
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|
|
So for now there is plain C# you can code in Visual C#?
hmm.. agh!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C# and C++!
|
|
|
|
|
I need a simple method for one instance of a winforms program to communicate with another. In Win32 I did this with a named event object but it doesn't look like there is an equivalent in the framework?
I just need a flag which can be set/reset and read by multiple processes.
|
|
|
|
|
|
Nish - Native CPian wrote:
I think you can use events.
Oops! I think I was wrong there
But you can use a named Mutex object if all you want to do is signal some state.
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Buy it, read it and admire me
|
|
|
|