|
Is there event before a window form closed? Is it BeforeClosing ? But I can't find it in C#.How to realize it ?
X4ever
|
|
|
|
|
There's Closing, Close, QueryUnload, and Unload. Look 'em up!
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
Xpelive,
The event you're looking for is Closing . The best way I have found to locate an event handler that is supported by an object is to select it in VS and look at the events list in the Properties pane... (press the lightning bolt button)... you can then select interesting looking ones and press F1 to get help on it!!!
HTH
Shaun
-----------------------------------------------------------------------
Shaun Austin: .NET Specialist. Spreading the word of .NET to the world... well the UK... well my tiny corner of it!!
|
|
|
|
|
Take a look at this[^]article,that would give you better idea.
Cheers,
Kannan
|
|
|
|
|
Hi, Friends! Does C# have a string function like CString of C++ ? but the C#' String is too small or I must to inheritance String and write a new class ? thx!
|
|
|
|
|
Well there's the string class/type... which maps to System.String which has pretty much all of the functionality of the MFC CString.
The problem is that it is marked as sealed which means you can't derive a new class from it... you could contain a string object in another class then write your new methods to work with the contained string...
What is it you actually want to do?
-----------------------------------------------------------------------
Shaun Austin: .NET Specialist. Spreading the word of .NET to the world... well the UK... well my tiny corner of it!!
|
|
|
|
|
thx! I want to know a word is the word's substring ot not, but System.String have not the function!
|
|
|
|
|
Can't you use IndexOfAny()???
e.g.
<br />
string myString = "Hello Dave, how are you today?";<br />
string searchString = "Dave";<br />
<br />
bool isSubstring = (myString.IndexOfAny(searchString)!= -1);<br />
<br />
if(isSubstring)...<br />
HTH
Shaun
-----------------------------------------------------------------------
Shaun Austin: .NET Specialist. Spreading the word of .NET to the world... well the UK... well my tiny corner of it!!
|
|
|
|
|
;P O ... ya.. thx! But, I always feel the String is too small , thank you very much !!
|
|
|
|
|
Anytime.
-----------------------------------------------------------------------
Shaun Austin: .NET Specialist. Spreading the word of .NET to the world... well the UK... well my tiny corner of it!!
|
|
|
|
|
Had a look at StringBuilder?
System.Text.StringBuilder
In C++, CString does the job of both System.String and System.Text.StringBuilder.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
What size should I use to get an equivalent C struct for the type bool?
i.e.
struct
{
DWORD a;
bool b;
} s;
would be
struct s
{
int a;
// bool a; or char a; or byte a; ?
}
...what's the best way to marshal C bools?
|
|
|
|
|
grv575 wrote:
...what's the best way to marshal C bools?
bool is not a C data type. Look at the typedef of it.
<a TITLE="See my user info" href=http:
|
|
|
|
|
unsigned char or int?
What's more common (VC 6 i guess, if anyone can check)
|
|
|
|
|
What does it say in the header file? It all depends how that implementation is defining it.
<a TITLE="See my user info" href=http:
|
|
|
|
|
Wish I knew. I deleted VS6 and am not keen on reinstalling it. In any case I'm almost certain it's typedef int bool or typedef enum { false, true } bool.
Either way, it looks like I need a dword size field.
|
|
|
|
|
I am writing a utility to help deploy some applications.
This utility is used to check the pre-requisites on a PC before an install will be attempted.
One of these aplications uses MAPI.Session and CDO.Message to recieve emails and send emails via SMTP.
How can I detect if MAPI and CDO are installed on the PC using C#
Thanks for your help
Andy
|
|
|
|
|
Thanks WiB,
I know what MAPI and CDO are but I am trying to find a way of checking they are installed on a PC.
My current testing since posting the question is this - which seems to be working.
protected void CheckMAPI()
{
try
{
Type objMAPIType = Type.GetTypeFromProgID("MAPI.Session",true);
object objMAPI = Activator.CreateInstance(objMAPIType);
if (objMAPI == null)
{
txtMAPIStatus.Text = "MAPI not installed";
}
else
{
txtMAPIStatus.Text = "MAPI Installed";
}
}
catch (Exception e)
{
txtMAPIStatus.Text = "MAPI not installed";
//MessageBox.Show ("Exception - " + e.Message);
}
}
|
|
|
|
|
I am creating a ocx that is a treeview.
I am trying to capture the OnNotify with
NMHDR *phdr = (NMHDR *)lParam;
// Coming from listview?
if( phdr->code == NM_RCLICK )
MessageBox(NULL, "Right click found", "Click", MB_OK);
but i am only getting the calls when the mouse is clicked on the header, same goes for Double click, what am I doing wrong,
any help is really appreciated
shotgun
|
|
|
|
|
I don't understand... looking at your code...
What is "->"????
Why do you have so much multiplication in the code too "*"????
And surely it should be MessageBox.Show("Right Click Found", "Click");
Sorry, Only joking ShotGun, but this is the C# forum...
Shaun
-----------------------------------------------------------------------
Shaun Austin: .NET Specialist. Spreading the word of .NET to the world... well the UK... well my tiny corner of it!!
|
|
|
|
|
Hi All,
How to read file into a structure? The file is created by VC++ 6.0.
For example:
VC++ Code:
struct MyStruct
{
short a;
int b;
char c[20];
short d;
};
CFile aFile;
...
MyStruct aStrcut;
aStruct.a = 1;
...
aFile.Write(&aStruct, sizeof(MyStruct));
I'd like to read the file into the following struct in C#, how? please advice.
[StructLayout(LayoutKind.Sequential, Pack=1)]
struct MyStruct
{
public short a;
public int b;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst=20)]
public string c;
public short d;
};
|
|
|
|
|
I'm kind of new to C#, but would like to make at simple monitoring tool for my internet connection - upload/download.
Is it possible to get acces to the Sent/Received on the "Locale Area Conection Status" - dialog?
It would also be nice if I could get a value for the Sending/Receiving speed.
|
|
|
|
|
|
Yes, thank you very much
|
|
|
|
|
Anyone know how to make a control transparent. The TransparentKey property is not available in the control as it is on a form ?
|
|
|
|