|
Hi folks,
I have an issue with the System.Diagnostics.PerformanceCounter class (and associated classes).
I have a Windows Service written in C# that creates and uses it's own performance counters and this all works fine on XP, but when I run the service on NT4 (the target platform, unfortunately) I get a PlatformNotSupportedException thrown.
Now, the documentation says the PerformaceCounter, and CounterCreationDataCollection are supported on NT4.0 workstation and server -- are the docs wrong, or is there a part of the jigsaw missing?
Cheers
Dr Herbie
Dr Herbie
Remember, half the people out there have below average IQs.
|
|
|
|
|
I've been playing around with SharpDevelop and C#, and started doing very simple C# programs. I created a textbox using the design view, went to the code view and modified some code. I built and ran the program, and it worked. So far so good.
But I switched to design view and back to code view again. Poof! My changes are gone. Bummer! My guess is that every time you switch from design to code view, it updates the code, throwing out changes you might have made.
The change I made is in the InitializeComponent() method, if it helps.
Does anybody know of a setting where I can disable this from happening? Or does it require a code fix?
Cheers,
Vikram.
http://www.geocities.com/vpunathambekar
"You still have the coolest name on CodeProject." — David Wulff to me.
|
|
|
|
|
You shouldn't be able to edit this... that method is SPECIFICALLY for designer-generated code. If you need to change a setting in this method then you should be doing so using the designer/property grid.
|
|
|
|
|
I fixed it by putting the code in the form's ctor after the call to InitializeComponent(), as Patric suggested.
Thanks!
Cheers,
Vikram.
http://www.geocities.com/vpunathambekar
"You still have the coolest name on CodeProject." — David Wulff to me.
|
|
|
|
|
When you use Visual Studio it adds the following little comment to your code right above the InitializeComponent() method
#region Component Designer generated code
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
private void InitializeComponent()
Put you changes in the OnLoad eventhandler or the contructor instead.
/Patric
My C# blog: C# Coach
|
|
|
|
|
I saw those comments, but just did not know where else to put them. Besides, the changes I made were pretty 'harmless'.
Patric_J wrote:
Put you changes in the onload eventhandler or the contructor instead.
That worked. I put them in the ctor *after* the call to InitializeComponent, and it worked beautifully.
Thanks, Patric!
Cheers,
Vikram.
http://www.geocities.com/vpunathambekar
"You still have the coolest name on CodeProject." — David Wulff to me.
|
|
|
|
|
Patric_J wrote:
///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
Perhaps the comment should be modified to explicitly state that it's autogenerated code and that changes will be lost using the header generated by the xsd tool as a template.
//------------------------------------------------------------------------------
// <autogenerated>
// This code was generated by a tool.
// Runtime Version: 1.1.4322.2032
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
//
//------------------------------------------------------------------------------
//
// This source code was auto-generated by xsd, Version=1.1.4322.2032.
//
|
|
|
|
|
hii all:
am developing an Encryption algorithm and i have to read the input file as block of bits . the block length 512 bits. i store them in bitarray collection, the problem is how can i convert them back using c# to 64 bytes?
marcoryos
|
|
|
|
|
Just use the CopyTo method of the BitArray class. If bitArray is your BitArray object then the following will work:
byte[] bytesArray = new byte[64];
bitArray.CopyTo(bytesArray, 0);
/Patric
My C# blog: C# Coach
|
|
|
|
|
Does any body have idea where i call below Sql syntax in Qurey Builder or Enterprise Manager?
And How to Call In C#.Net
=======================
EXEC GenerateScript @server = 'Server_Name',
@uname = 'User_Name',
@pwd = 'Password',
@dbname = 'Database_Name',
@filename = 'c:\File_Name.sql'
==============================
Muhammad Waqas Butt
|
|
|
|
|
public SqlDataReader listArticlesByPopularity(int howmanyrows)
{
// Create Instance of Connection and Command Object
SqlConnection conn = new SqlConnection(this.ConnectionString);
SqlCommand cmd = new SqlCommand("GenerateScript", conn);
cmd.CommandType = CommandType.StoredProcedure;
SqlParameter param= new SqlParameter("@server", SqlDbType.NChar,32);
param.Value = "server";
cmd.Parameters.Add(param);
...
param = new SqlParameter("@filename", SqlDbType.NChar,64);
param.Value = "c:\File_Name.sql";
cmd.Parameters.Add(param);
// Execute the command
conn.Open();
SqlDataReader result = cmd.ExecuteReader(CommandBehavior.CloseConnection);
// Return the datareader result
return result;
}
Live Life King Size
Alomgir Miah
|
|
|
|
|
I have 2 forms frst: containing DataGrid and snd:Containg filter fields.
i need to open the second form and applay a filter on the DataGrid.
the 2 forms must be opend at the same time.
Abdalah
|
|
|
|
|
This is the first time I am programing to read the contents of mail from outlook. I am using Microsoft Outlook 11.0 Library which comes with Outlook 2003. I am able to read the emails and its conents but I am not able to read the attachments. Can anybody help me out please.
SVSP
|
|
|
|
|
Hi Man,
I read you question but i am not able to answer you infact i have a request to you if you kindly tell me how you actually use Outlook library and able to read the mails. If possible you send me code..
I shell be very thankfull to you.
Muhammad Waqas Butt
waqasb4all@yahoo.com
|
|
|
|
|
Hey guys, I have a makefile called "makefile" with the following contents
all: RemoteAssembly.dll
RemoteAssembly.key:
sn -k RemoteAssembly.key
RemoteAssembly.dll: RemoteAssembly.cs RemoteAssembly.key
csc /t:module RemoteAssembly.cs
al /v:1.0.0.0 /keyfile:RemoteAssembly.key \
/out:RemoteAssembly.dll RemoteAssembly.netmodule
clean
-del *.netmodule
-del *.dll
What is the correct syntax for using nmake on makefile.
I type "nmake.exe:makefile" on the .NET command prompt on the directory where I stored all the dependents and the makefile.
But, they said the filename, directory name or volume label syntax is incorrect.
|
|
|
|
|
Why mouse wheel message doesn't work?
I made a control, derived from Form, and want to carry messages of mouse, i made all except mouse wheel... What's wrong?
|
|
|
|
|
hello
i have 2 forms .
how do i change form2 button control text from form1?
what interface do i need to add?
thanks
Have a nice Day
|
|
|
|
|
There are three steps involved in using form to form communication:
1. Create a reference to form2 from form1.
2. Set your reference equal to your instance.
3. Set your control to public.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Since we are dealing with objects here, you have to make sure they know about each other (at least form1 knows about form2). The way to do this is to create a reference to form2 from form1:
public class Form1 : System.Windows.Forms.Form<br />
{<br />
private Form2 form2 = new Form2();<br />
...}
2. Setting your reference to the instance of form2. Something like this:
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
Form2 frm2 = new Form2();<br />
frm2.Show();<br />
form2 = frm2;<br />
}
3. Set the control to public (in form2):
public class Form2 : System.Windows.Forms.Form<br />
{<br />
public System.Windows.Forms.Button button1;<br />
...}
NOTE: your autogenerated code should already have a definition of the button1 but it will be set to private, what you are doing here is changing it to public.
Any question let me know.
Peter Corcoran
peter@corcoranp.com
www.corcoranp.com
|
|
|
|
|
Thank you very much
exactly what i needed
Have a nice Day
|
|
|
|
|
I want to encode some url parameter in my Windows Form Application but
I can't use System.Web.HttpServerUtility or System.Web.HttpUtility from my application. Please help me.
|
|
|
|
|
Add a reference to the System.Web dll.
---
b { font-weight: normal; }
|
|
|
|
|
Add System.Web.dll using Refrence folder context menu. And then try to refer in your application
Using System.Web;
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
MessageBox.Show(System.Web.HttpUtility.HtmlDecode("http://www.codeproject.com"));<br />
}<br />
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Hello there
I am new in CSharp. I created a doubleClick event and attached it with multiple controls. Now I want to get the name of the control when user double clicks. in the event I have Sender as object and when I write Sender.Name or any other property it gives error that Object Does not Contain the definition of Name. Please Guide me how to get the name or how to convert the object into the required control. for eg panel control.
Rizwan Bashir
|
|
|
|
|
Try to cast your 'sender' to you known type.
Eg:
private void Form1_DoubleClick(object sender, System.EventArgs e)<br />
{<br />
Form frm=sender as Form;<br />
if(frm!=null)
MessageBox.Show(frm.Name);<br />
}
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Just cast it to Control , it should work. Unless you are firing events and providing some other object as the sender.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|