|
I want to know a question from you that i want to apply a timer between my code.ca you help me please.
means that for example i have two lines of code let say.
Method1();
Method2();
Now i wana to do that after 10 seconds the Method2 occurs(not every 10 sec).
Method1();
//timer of 10 sec//
Method2();
Means that when Method1 occurs then after 10 sec Method2() should be executed..
Please help me
with regards
Ishtiaq Ahmed
|
|
|
|
|
Hi,
I would like to force a change to the short date format in the time regional settings when i run my application. How can this be done?
Thanks for any help.
Regards,
Stephen
|
|
|
|
|
Not a good idea at all. Changing the setting system wide will affect other applications running on the system at the same time. This is usually not tolerated by users and is HIGHLY discouraged.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
You could try changing the region for your application. But don't do it for the entire system.
-- LuisR
Luis Alonso Ramos
Intelectix - Chihuahua, Mexico
Not much here: My CP Blog!
|
|
|
|
|
About three weeks ago I started the laborious task of teaching myself C# .NET....having zero OOP experience has made the process fairly difficult. I am building a small systems management application “mostly as a learning experience” and I’m stuck on two issues. First, I can’t figure out how to add a NT logon name/account to Active Directory…I can add pre-windows users, but that’s it. Second, I’m trying to control directory/folder security permissions; but again, I’m stuck. I’ve tried to implement the FileIOPermission class, but it doesn’t seem to apply to directories/folders.
I appreciate your help,
Thanks,
Mark
|
|
|
|
|
How do I place a link label on a datagrid column?
|
|
|
|
|
Hi all,
I have a ServicedComponent derived class which has a private local variable. When a method of that class is called and I try to assign a passed parameter to the local variable, it doesn't. The local variable continues to have its original value.
What am I doing wrong? Or what configuration steps should I be taking that I am missing in order to make it work?
Here is the sample program.
using System;
using System.Data;
using System.Data.SqlClient;
using System.EnterpriseServices;
using System.Runtime.CompilerServices;
namespace test02
{
///
/// Summary description for Trx.
///
[Transaction(TransactionOption.Required, Isolation = TransactionIsolationLevel.Serializable)]
public class Trx : ServicedComponent
{
SqlConnection _conn;
SqlDataReader _rdr;
int _i = 45;
string _connstr = "Integrated Security=SSPI; Persist Security Info=False;Data Source=TMC092; Packet Size=4096;Initial Catalog=pubs;";
public Trx()
{
}
[AutoComplete(true)]
public void execute(int i)
{
_i = i;
useDataset();
}
private void useDataset()
{
_conn = new SqlConnection(_connstr);
SqlCommand selectCMD = new SqlCommand("SELECT au_id, au_lname FROM authors", _conn);
selectCMD.CommandTimeout = 30;
SqlDataAdapter custDA = new SqlDataAdapter();
custDA.SelectCommand = selectCMD;
_conn.Open();
DataSet custDS = new DataSet();
custDA.Fill(custDS, "Customers");
foreach(DataRow r in custDS.Tables[0].Rows)
{
Console.WriteLine(r[0]);
}
_conn.Close();
}
}
}
The calling function is simply:
static void someMethod()
{
try
{
Trx tx = new Trx();
tx.execute(78);
}
catch(Exception e)
{
Console.Write(e.Message);
}
}
from within another class.
The local variable _i shows its value as zero, not 45, not 78, but zero. What's going on?
Thanks for all help.
|
|
|
|
|
I have created a windows service and would like to print some pdfs. I have the code written which basically print the pdf by first putting it on a clipboard and then printing it, but the problem is the pdfs will not print. Under task manager, I can see Acrobat running. I know windows service run in a different environment and there is a way that I can make it talk to the dsektop. I just don't know how to do it. Can someone help me? Thanks for your time.
|
|
|
|
|
I had done this a couple of years ago, but I dont remember much .... however, here is what i can recall ... run the service as an administrator .... not sure if its needed .... and make sure allow service to interact with desktop is checked ... I will check to see if I can find the code ....
see if this link helps ...
http://www.codeguru.com/Cpp/W-P/system/ntservices/article.php/c2857/[^]
Shardool Karnik
Lead Software Engineer
Compass Technologies, Inc.
http://www.compasstec.com
|
|
|
|
|
I have a domain with a number of PC's that are often turned off, and I would like to be able to retrieve just the ones that are currently accessible. I am currently using the following code which retrieves PC info from Active Directory, but then attempting to access the unavailable ones gives me lots of errors:
DirectoryEntry entry = new DirectoryEntry("LDAP://" + labelDomainName.Text);
DirectorySearcher searcher = new DirectorySearcher(entry);
searcher.Filter = "(objectClass=Computer)");
foreach( SearchResult resEnt in searcher.FindAll() )
{
name = resEnt.GetDirectoryEntry().Name.ToString().Remove(0,3);
}
Any help would be much appreciated
|
|
|
|
|
Hi folks,
Do I need to use the [MethodImpl(MethodImplOptions.Synchronized)] attribute on statis methods, or are they implicitly thread-safe?
Thanks in advance.
Dr Herbie
Remember, half the people out there have below average IQs.
|
|
|
|
|
Static methods are like normal methods with respect to thread safety. You do need to protect them with some kind of synchronization mechanism..
By the way, are you sure you'd want to the use the MethodImpl attribute for synchronization? AFAIK, all methods with that attribute share a single lock, so if one thread is executing one method, no other thread will be able to execute *any* method with that attribute.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
i want handle print command in windows.
when ever any user uses Ctrl-P or clicks on print command from any windows application for example MS-word or Acrobat reader etc it should go through my application.
i want to calculate the number of pages printed by the user and allow printing according to the nunber pages in the print command.
i would like to know any option where i can handle this in C#.
please let me know as soon as possible
its very urgent...
please
-----
| |
|----
| \
| \
| \
|
|
|
|
|
I want to make a animation that moves from a position value using Timer and AutoResetEvent...
I implemented it like this...
AutoResetEvent are;
private void StartMovie()
{
ptimer=new System.Windows.Forms.Timer();
ptimer.Interval=10;
ptimer.Tick += new EventHandler(pTimerOnTick);
ptimer.Start();
}
private void pTimerOnTick(object sender, EventArgs e)
{
if(movingK<=605&&isMoving)//till movkingK(pos_X)<605 show it's moving.
{
are.Set();
movingK+=10;
Invalidate();
are.ReSet();
are.WaitOne();
}
else
{
are.Set();
StonePut(b_intStone,intValueTemp,b_selectedStone,selectValueTemp,First,0);
ptimer.Stop();
ptimer.Tick-=new EventHandler(pTimerOnTick);
isMoving=false;
}
}
private void DThis1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
{
rectDst=new Rectangle(movingK,movingKY,54,60);
grfx.DrawImage(GeneralsImage,rectDst,rectSrc,GraphicsUnit.Pixel);
//paint rutine has no problem...
}
actually I did not understand well AutoResetEvent and how to it wait event and go next job... I think if it needs a loop then it goes more complex.
please someone help me and show me a good implementation of this problem.
Image will remind us some feelings and if I can ask someone about a problem, that's not a bad life.
|
|
|
|
|
Hi
i don't understand your problem well . if you want to create an animation by showing a picture in every constant time it would be like this :
private void StartMovie()<br />
{<br />
ptimer=new System.Windows.Forms.Timer();<br />
ptimer.Interval=10;<br />
ptimer.Tick += new EventHandler(pTimerOnTick);<br />
ptime.AutoReset = true ;<br />
ptimer.Start();<br />
}<br />
private void pTimerOnTick(object sender, EventArgs e)<br />
{<br />
if(movingK<=605&&isMoving)
{<br />
are.Set();<br />
movingK+=10;<br />
Invalidate();<br />
are.ReSet();<br />
are.WaitOne();<br />
}<br />
}
in onpaint event draw any picture that must be shown to create an animation.
why you create a new tick event handler in pTimerOnTick in else block ?
do you want to simulate the autoreset ?
Amir Jalaly
|
|
|
|
|
I don't see any reason for you to use an AutoResetEvent. As far as I can see, pTimerOnTick is called by only one thread (the UI thread), so you don't need any synchronization mechanism at all.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
I've installed certificate with private key on my machine. And tried to encrypt and decrypt a file using public/private key(Asymmetric), its happening.
Now when I exported the certificate with public key and encrypt it on different machine using the exported public key, its happening. But when the same encrypted file when tried to decrypt on my machine using associated public key's private key, its giving an error "Bad Data".
If anybody know how to resolve this issue then please share their knowledge.
What I basically want is..
*) Export the certificate onto some other machine, lets say machine 'B', from machine 'A', only with the public key.
*) Encrypt the file using the public key on machine 'B'
*) Decrypt the file using associated public key's private key on machine 'A'.
Thanks & Regards,
Shiby
|
|
|
|
|
dear all
how to use unmanaged code inside C# ?
Specially MFC?
thx
|
|
|
|
|
use unmanaged dll's and pInvoke. lots of articles here
there are no facts, only interpretations
|
|
|
|
|
i still need more explaination , i need examples
do u know any specific article about this item ?
thx
|
|
|
|
|
Hi There,
I want write a virtual keyboard in different languages.
i need some kind of guidance about the database design to store the languages and the communication with the opened applications to be written.
i am not loogink for code but i need a guidance.
Rgds,
Nir
|
|
|
|
|
these function as mentioned above ,i can do ;but how can i write class to implement these functions thinks a lot!!
|
|
|
|
|
I found an MSDN article "KB302902" that explain how to use excel with late binding, but running the code at runtime, IDE generate an exception at the line:
//Add a new workbook.
objBook = objBooks.GetType().InvokeMember( "Add", BindingFlags.InvokeMethod, null, objBooks, null );
This happen on excel 2003 (os winXP), the same code on office XP (win2k) work properly.
Any ideas to solve problem?
Thanks a lot.
marco
|
|
|
|
|
Excel automation code fails in non-English Standard and Formats
To bypass problem, use the "en" culture using an overloaded signature.
Excel accepts the call without the runtime error, sample code:
....
System.Globalization.CultureInfo cultInfo = new System.Globalization.CultureInfo("en");
Type objClassType = Type.GetTypeFromProgID("Excel.Application");
object objApp = Activator.CreateInstance(objClassType);
object objBooks = objApp.GetType().InvokeMember( "Workbooks", BindingFlags.GetProperty, null, objApp, null, cultInfo);
object objBook = objBooks.GetType().InvokeMember( "Add", BindingFlags.InvokeMethod, null, objBooks, null, cultInfo);
object objSheets = objBook.GetType().InvokeMember( "Worksheets", BindingFlags.GetProperty, null, objBook, null, cultInfo);
object[] Parameters = new Object[1];
Parameters[0] = 1;
object objSheet = objSheets.GetType().InvokeMember( "Item", BindingFlags.GetProperty, null, objSheets, Parameters, cultInfo);
...
marco
|
|
|
|
|
Hi there
I am using a viewer panel (a class that i find in codeproject). This class gave me the opportunity to put a larger image in a panel with autoscroll bar. Now I want to made a function that give me the place where is the mouse when I click in this panel.
THe problem is when i click on the panel nothing happens =/
In my point of viem what is happening is the folowing, I have an image on the panel, so I made my click on the image and not on the panel.
How can I solve this? I just what to make a messagebox to appear when i click in a point of the panel.
Thanks, Sérgio
|
|
|
|