|
i'm using SqlServer 2000 desktop edition.
and what object were u talking about
|
|
|
|
|
Good Morning,
I have to create object of c# class in aspx.cs class .
I'm not sure whether it is good to create instance of that class globaly or to create its instance in every evnt block in aspx.cs file.Which one would be efficient and good way of programming?Please guide.
yog
hui gfgh kgdgrt njjn hjgkn
|
|
|
|
|
Hello yogita ,
It depands on your working scenerio.
If its just class with some methods to call then I suggest to Create instance in every aspx but please dispose that object too.
If that class contains session or user information then you may use in global class.
Thank You.
|
|
|
|
|
Thank you.
yog
hui gfgh kgdgrt njjn hjgkn
|
|
|
|
|
|
|
|
|
Hello Samira,
Here is a code with you can get the Mac adrress of local machine
i hope this will help full to you.
private static string GetMacAddress()
{
string macAddr = "";
try
{
ManagementClass mc = new ManagementClass("Win32_NetworkAdapter");
foreach (ManagementObject mo in mc.GetInstances())
{
macAddr = mo["MACAddress"] as string;
if (macAddr != null && macAddr.Trim() != "")
return macAddr;
}
}
catch (Exception exp)
{
}
Random ranGenerator = new Random(6);
macAddr = ranGenerator.Next(100000, 999999).ToString();
return macAddr;
}
Regards,
Irfan.
|
|
|
|
|
hello
i have developed a desktop application in C#.net 2.0 where i need to retrieve all installed browser plugins names in the loacal machine.That means the application will retrieve all the installed browser plugin names from the pc where this application run.
Please helpme to find a way to retrive the installed plugin names.
Thanks and regards
Sourav
|
|
|
|
|
:|Hi,
can any one give me a win32 api and also a control or library that can get the NEC MAC address from the Hardware itself not from the registry. it will be good if it can be used in C#.
May god give u good health and knowledge.
|
|
|
|
|
Hi, I'm wondering how I can remove the 'Close' button on a modal dialog. The reason is I don't want the user to accidentally close this partiulcar window, or at least display a confirmation to the user to ask whether if they really want to close it. I can't do that with the Form_Closing event as it stills closes it.
|
|
|
|
|
write your code int Dispose Method.e.g
protected override void Dispose( bool disposing )<br />
{<br />
<br />
if(DialogResult.Yes==MessageBox.Show("Do you Want to quit?","Quit",MessageBoxButtons.YesNo))<br />
{<br />
if( disposing )<br />
{<br />
if(components != null)<br />
{<br />
components.Dispose();<br />
}<br />
}<br />
base.Dispose( disposing );<br />
}<br />
else<br />
return;<br />
}<br />
|
|
|
|
|
|
When the Form is getting disposed it is already closed. So this doesn't work. Dispose is about freeing resources - no more no less.
Robert
|
|
|
|
|
Hi,
why can't you do this with the Closing event? This is exactly what it is meant for. Post some code. You have most probably some mistake in your code.
Robert
|
|
|
|
|
Robert, I don’t want say this but I have to say Check your Premise
|
|
|
|
|
Hi,
even after looking in a dictionary about premise I don't really get what you want to say. May be my mistake because english is not my native language. Could you reformulate?
Robert
|
|
|
|
|
bankai123 wrote: I can't do that with the Form_Closing event as it stills closes it.
You can. If the user doesn't want to close the form, assign true to the Cancel property of the passed CancelEventArgs instance.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thanks, that's exactly what I was looking for. I gotta learn to read MSDN better :P
|
|
|
|
|
I have a Main Form call FormA, FormA call a Lookup Form named FormB using following Code
<br />
FormB formb = new FormB();<br />
FormB.Show();<br />
in FormB there is a textboxA to let the user to enter certain string value that need to passback to FormA and execute several statements in FormA when user press a button in FormB
Any1 has any idea how to do that?my fren advise me to use delegate but i not very familiar with delegate coding structure, i greatly appreciated if any1 can provide the sample coding to do that;)
|
|
|
|
|
There are many ways to accomplish your task.
1) Best way would be to make a custom event. As you told that you dont know much about delegates so I think it will be even difficult for you.
2) Make a static method in FormA and call it from FormB's click event handler by either passing it this (FormB object) as an argument if FormB is not class variable in FormA. In that method get all the values from FormB and then you could just close FormB or even destroy it.
3)In the click event handler of FormB, get its Parent by FormB.Parent, this will yeild you the reference to FormA's object. Now you could do anything with it.
You can use any of the above mentioned way. Hope it helps.
Regards
Khalid
|
|
|
|
|
Thanks man, i am trying the method u suggest
|
|
|
|
|
Hi every body,
I have to call a DLL that contain a function follow:
typedef struct _ProStruct {
HANDLE hProcess;
HANDLE hThread;
DWORD dwProcessId;
DWORD dwThreadId;
} ProStruct
int MyBuggingFunc(long bDebugMode,ProStruct* pProStruct,TCHAR* Location);
When I call it in C# 2005 such as:
public struct ProStruct{
long hProcess;
long hThread;
int dwProcessId;
int dwThreadId;
}
[DllImport("MyBugFunc.dll",CallingConvention = CallingConvention.Cdecl)]
public static extern int MyBuggingFunc(int bDebugMode,
ProStruct pProStruct,String Location);
private void Form1_Load(object sender, EventArgs e)
{
try
{
ProStruct pPI = new ProStruct();
int ret = MyBuggingFunc((int)(1), pPI, "MyTest.dkt");
}
catch (Exception loi)
{
MessageBox.Show(loi.Message);
}
}
When the form is loaded, there is an error occurs:
"PInvokeStackImbalance was detected
Message: A call to PInvoke function 'WindowsApplication4!WindowsApplication4.Form1::MyBuggingFunc has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
"
I assume some parameters have incorrect type with convention in calling DLL from third party DLL. I tried to fix it many times but I get the the same error.
Could you help me to resolve my problem?
Thanks all of you!
Hoang Quoc Dat
|
|
|
|
|
Your long types are what's wrong. In C++, long is 32-bits long. In C#, long is an alias for System.Int64, which is 64 bits long.
Try this:
public struct ProStruct{
int hProcess;
int hThread;
int dwProcessId;
int dwThreadId;
}
|
|
|
|