|
A variable is used in multiple threads. In a particular place, I am modifying the content of variable. So I am doing syncronization. in another place, just I am reading the data. Should I synchronize in the second place?
|
|
|
|
|
Just make a lock statment to the variable while any thread is using it till it finishes.
If I unserstood right?
|
|
|
|
|
Yes, you should. Locking the write operation only prevents multiple threads from writing to the same variable at once. If you don't protect your read operations, there is a chance that you might read in some inconsistent state when another thread is writing to the variable.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hello
I'm using System.Windows.Forms.Label and I want to add some text, where one or more words are bold or italic.
I tried it with html tags but does not work. Somewhere i did read it should be done by html tags. I did it like this:
label1.Text="my <b>test</b> string";
In the output i can see the html tags.<
I hope someone can tell me how to do this.
Thanks
Roggey
|
|
|
|
|
Not supported by the label control. You'll either have to use multiple label controls for each word that is different (a messy solution), or come up with your own variant that supports it. The RichTextBox does support different fonts in the text stream, but is a rather heavyweight control to use as a label.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You can do just what you want in your paint method but you'll need to get a little more involved that you might want to. Basically what you need to do is paint the text of your control yourself. You'll notice that DrawString has a parameter for the font. Just use that and draw the string in sections, one for each font you are using. This also means that you'll need to use MeasureString for each piece as you draw it so you can get the next section to align to the proper place following the preceeding piece.
Hope that makes sense.
|
|
|
|
|
HI,
I have a C# test application developed in Visual Studio .NET 2003. But I want to run it in Visual Studio .NET 2005. But I counldn't run it. It shows that .NET framework 1.1 requires for it to run. I tried to solve problem by registry. But it failed. Can anyone have an idea? Please let me know.
Regards,
Rathish P S
|
|
|
|
|
What do you mean "run it in Visual Studio 2005"? Do you mean run it under .NET 2.0?
The only thing I can think of, is if the application has a .config file specifying the version it needs to run on.
Tech, life, family, faith: Give me a visit.
I'm currently blogging about: Horrific Minnesota Radio
Judah Himango
|
|
|
|
|
HI,
I have a set up Application in C#.Net 7.1. It is an AddIn to IDE. When I tried to run this application in c# 8.0, an error "Class Not registered" is thrown. Can anyone tell me the reason?
Regards,
Rathish P S
|
|
|
|
|
Hi,
How do I check if a c# program got permission to a network folder or file. Is there anyway I can change the permission if the program dont have the access rights to it?
|
|
|
|
|
Hi all.
I want to generate a hashcode from string and encrypt it with the private key of a .sn file (strong name key pair).
The purpose is to hash the contents of a configuration file, encrypt it, and add the encrypted hash to the file.
At runtime, I want to decrypt the hash with the public key of the assembly, and determine whether the hash is the same of the current hash of the contents.
I have no idea how to do that in practical, can you give some guidelines for that?
Any references would be welcome.
Thanks a lot,
Yaakov
|
|
|
|
|
hmm.... I will look in to it man !
|
|
|
|
|
|
Hi, i used this code i hope it helps u and u understand it
RSACryptoServiceProvider RSA;<br />
RSA = new RSACryptoServiceProvider();<br />
byte[] rawData, hash;<br />
HashAlgorithm HashMan;<br />
HashMan = new SHA1CryptoServiceProvider();<br />
rawData= System.Text.Encoding.Unicode.GetBytes(string PASSWORD); hash = HashMan.ComputeHash(rawData);
RSAPKCS1SignatureFormatter sf = new RSAPKCS1SignatureFormatter(RSA);
sf.SetHashAlgorithm("SHA1");<br />
byte []FinalSignature= sf.CreateSignature(hash);
<br />
RSA.ExportParameters(false);
RSA.ToXMLString(false);
ull send to the receiver the FinalSignature and the RSAParameters or the string with the public key.
in the receiver
<br />
RSAPKCS1SignatureDeformatter sd=new RSAPKCS1SignatureDeformatter(parameters);<br />
RSAPKCS1SignatureDeformatter sd=new RSAPKCS1SignatureDeformatter();<br />
sd.FromXMLString(string xmlParameters);<br />
sd.SetHashAlgorithm("SHA1");<br />
bool pd=sd.VerifySignature(hashinurdatabase,FinalSignature);<br />
<br />
i hope it helps u with the code if u dont uderstand something or want to ask something just say here or emailme.
U will need to give to the SignatureDefformater the parameters of the RSACryptoServerProvider u used in the SignatuerDefformater or it will return u false.
|
|
|
|
|
Thanks for the detailed answer.
If I get it right, I can replace the following code:
HashAlgorithm HashMan;<br />
HashMan = new SHA1CryptoServiceProvider();<br />
rawData= System.Text.Encoding.Unicode.GetBytes(string PASSWORD); <br />
hash = HashMan.ComputeHash(rawData);<br />
RSAPKCS1SignatureFormatter sf = new RSAPKCS1SignatureFormatter(RSA);<br />
sf.SetHashAlgorithm("SHA1");<br />
byte[] FinalSignature= sf.CreateSignature(hash);
with this one:
rawData = System.Text.Encoding.Unicode.GetBytes(string PASSWORD); <br />
byte[] FinalSignature = RSA.SignData(rawData, "SHA1");
Is that correct?
Yaakov
|
|
|
|
|
i am not sure, i think i tried that way but it didnt work for me, i needed to sign the data from the hash with the signature formatter cause it will encode it too.
Try if u can do it that way, but i think the sign data didnt do the same as the signatureformatter
|
|
|
|
|
Hi,
I would like to find out how to use paging in my datagrid?
I have created the datagrid that pulls data from SQL 2000. I am displaying all the records. What I want to do is display 10 records at a time.
I have used paging but when I run the app and click next the same 10 records is displayed.
Can someone please tell me how to page trhough the data?
Thanks!
Illegal Operation
WannaBe and GonnaBe Systems Developer
|
|
|
|
|
an event should be fired when clicking next page. Implement an eventhandler for the event, you can there alter the page of your datagrid. More info on MSDN.
Good luck.
No hurries, no worries.
|
|
|
|
|
I have created an event.
private void DataGrid1_PageIndexChanged(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)
{
DataGrid1.CurrentPageIndex = e.NewPageIndex;
DataGrid1.DataBind();
}
but when running the site, the event does not execute???
Illegal Operation
WannaBe and GonnaBe Systems Developer
|
|
|
|
|
you 're using ASP.NET? not winforms?
In that case you should look into the lifecycle of the page. Try to bind the eventhandler sooner then the Load event (init eg.)
The lifecycle of asp.net pages is, in my opinion, not so easy to understand, but it is quite important.
good luck!
No hurries, no worries.
|
|
|
|
|
Hi all,
I want to add search Panel to 5 Forms in my C# Application..But I can not declare search panels one by one and coded to every forms..it is wasting my time.
Can I use User Control and decalre search panel in there and added to every Forms?
Or is there good way to do that?
please reply me soon..
thanks in advance..
|
|
|
|
|
The easiest way is to create one base form, add the panel to that form. All the 5 forms should then inherit from the base form.
60% of statistics are made up on the spot
|
|
|
|
|
Make a user control (search panel) and make a MyForm class which inherits Form. Then add the user control to the MyForm.
When u need a Form with a search panel, just make add a new Form class and substitute the Form inheritance with MyForm.
public class SearchForm1 : MyForm
{
}
I'm in the high-fidelity first class traveling set.
And I think I need a Lear jet.
|
|
|
|
|
Thanks for reply..All the procedures are working.
|
|
|
|
|
Hi All
I have a windows service with 2 service classes.. and in the OnStart()method of both classes i am doing a event log to check if both are started.. When i install the service and run it by clicking on it..It Shows message from the first Service Class.. I dont know what to do..Please Help
Regards
RameeDev
public CFirst()
{
InitializeComponent();
if(!EventLog.SourceExists("CFirstLog"))
{
EventLog.CreateEventSource("CFirstLog","CFirstLog");
}
evLog = new EventLog("CFirstLog");
evLog.Source = "CFirstLog";
}
static void Main()
{
System.ServiceProcess.ServiceBase[] ServicesToRun;
ServicesToRun = new System.ServiceProcess.ServiceBase[] { new CFirst(),new CSecond()};
System.ServiceProcess.ServiceBase.Run(ServicesToRun);
}
protected override void OnStart(string[] args)
{
evLog.WriteEntry("CFirst Started");
}
I am doing the same in CSecond Class
rameedev
|
|
|
|