|
how can i write the program alike search in windows? Help plz!
|
|
|
|
|
hi,
you can use DirectoryInfo and FileInfo Classes from System.IO namespace and do recursive search.
|
|
|
|
|
Hi all
i have the folloeing code to run a batch file
System.Diagnostics.ProcessStartInfo psiinfo=new System.Diagnostics.ProcessStartInfo("aaa.bat");
psiinfo.WindowStyle=System.Diagnostics.ProcessWindowStyle.Hidden;
psiinfo.CreateNoWindow=true;
System.Diagnostics.Process p1=System.Diagnostics.Process.Start(psiinfo);
while(!p1.HasExited);
//
//Following some other code
//
It works fine with Xp and 2000. But the problem comes with windows 98
in that after executing the batch file the batch file will not get closed . instead it will become an inactive window and the user has to close it manualy . So "has Exited " is not working here since the process is not getting closed. is there any way to find out whether the process in inactive or completed execution ..
thanks in Advance
AnnS
Suffering cheerfully endured, ceases to be suffering and is transmuted into an ineffable joy.
|
|
|
|
|
Try giving other processes some CPU time as well: replace your while loop by:
while(!p1.HasExited) Thread.Sleep(200);
AFAIK older Windows such as Win98 are not as good in switching processes in time,
so you should not choose a delay that is much smaller; your code was keeping the
current process very busy, and I guess Win98 could not deal with that.
Luc Pattyn
|
|
|
|
|
hi all
i want to darw a waterfall diagram with directx . but i don't know how and from where should i begin .
any idea would be helpfull.
|
|
|
|
|
You will need the DirectX SDK package, and some examples.
Search for DirectX on CodeProject !
Luc Pattyn
|
|
|
|
|
Hello,
I am developing a windows service in VS 2005 that will monitor time and do something every 5 seconds.
I have created some code using the stopwatch class. Can anyone tell me if this is the best way to do this .
<br />
protected override void OnStart(string[] args)<br />
{<br />
sw.Start();<br />
this.RunningTime();<br />
}<br />
<br />
protected override void OnStop()<br />
{<br />
sw.Stop();<br />
}<br />
<br />
private void RunningTime()<br />
{<br />
if (sw.IsRunning)<br />
{<br />
if (sw.Elapsed.Seconds == 5)<br />
{<br />
}<br />
}<br />
}<br />
Many thanks in advance,
Steve
|
|
|
|
|
In my opinion the best way would be to use one of the timer classes cause by using StopWatch you would end up with active waiting. As you're programming a service the System.Windows.forms.Timer component should not work as it relies on a message pump, but you can either use System.Timers.Timer or System.Threading.Timer class. Take a look at their documentation to get an idea on how to use them.
"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
|
|
|
|
|
Hi,
I am framing a sql statement like this select file_id,file_name from XCalibur_files where path Like 'c:\xalibur\*'(
C:\xcalibur\system\programs path exists in the table)
but it is returning zero results.
This is the code..
string AccessConn = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Xcalibur\System\Programs\XCalibur Database.mdb;Jet OLEDB:Database Password=170464PassFinn;";
//Create an OleDbConnection object,
//and then pass in the ConnectionString to the constructor.
OleDbConnection cn = new OleDbConnection();
cn.ConnectionString = AccessConn;
//Open the connection.
cn.Open();
string str1 = "select file_id,file_name from XCalibur_files where path Like '";
string str2= "c:\\xalibur\\"+ "*'";
//Use a variable to hold the SQL statement.
string selectString =str1+str2 ;
//Notice that this line passes in the SQL statement and the OleDbConnection object
OleDbCommand cmd = new OleDbCommand(selectString,cn);
//Send the CommandText to the connection, and then build an OleDbDataReader.
//Note: The OleDbDataReader is forward-only.
OleDbDataAdapter oledataadapter= new OleDbDataAdapter(cmd);
DataSet ds = new DataSet();
oledataadapter.Fill(ds);
MessageBox.Show(ds.Tables[0].Rows.Count.ToString());
Where i am doing wrong?
|
|
|
|
|
If I recall right the "*" character has no special meaning in a LIKE clause for Access or at least not the one it has in a shell. I think you have to use the "%" character if you want to match all path starting with "c:\\xalibur\\".
Furthermore you should use parameterized queries instead of building the queries by string concatenation as the latter is more error-prone and not safe against injection attacks. Take a look at the following article for more information: SQL Injection Attacks and Some Tips on How to Prevent Them[^]
"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
|
|
|
|
|
when i try to save a image to hard disk i got a Error ,Generic Error Ocurred GDI+
this is the code
img.save(path,imageformat);
please help
""""""""
|
|
|
|
|
This error is quite general, and ill descriptive. Could you please post more code of what you are trying to do exactly?
Regards
|
|
|
|
|
|
PS.
Your question -and code which is not surrounded bu pre tags- is a bit vague. I'm taking guesses here.
You don't need to call the event handler itself -though there are ways of doing it-. You can simply extract the code into a common method:
private void b1_Click()
{
MyMthod();
}
private void MyMethod()
{
}
Was that what you were looking for?
Regards
|
|
|
|
|
Maybe the Button.PerformClick method is what you're looking for.
"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
|
|
|
|
|
Hi all
The following is the code for tree view child node text i am accesing the child node text from another Form2 but it doesnt works when i am running the applictaion the child node is created but the name doesnt appears
TreeNode childnode = new TreeNode(objform2.textBox1.Text);
root.Nodes.Add(childnode);
SAS
|
|
|
|
|
|
Hi
Urgent Please help.
I am creating word template project. I want to access the active document in this project.
Please help me to which instance I should us to access active document.
Thanks in advance
Amit
|
|
|
|
|
i have created a website but i am facing problem to create option "remember password on same computer"
if anyone have idea or code to use the same option please send me.
thank you!!!
contact me: ashish.0619@gmail.com
|
|
|
|
|
Ashish Porwal wrote: code of remember me!!!
System.out.print("remember me!!");
|
|
|
|
|
How to write the bussiness rules in triggers i want some examples
Hi all,
vikram929
|
|
|
|
|
Hello:
I'm having a bit of trouble understanding the use of passing a collection object (in my case an ArrayList) as a ref parameter to a method that needs to add to the collection or otherwise modify the ArrayList's contents. Basically, I'm wondering which is the better, or more accepted, way to do this.
Consider the following bit of code - Both of my Test methods will modify the contents of my ArrayList and allow me to access all the values in my Main() method. However, I don't really understand which would be the better way to do it. Could someone please provide me a bit of understanding on this particular use of ref? Maybe what the pros and cons are of the two ways I do it here... why would I pick one way over the other?
Thanks!
using System;
using System.Collections;
namespace TestConsoleApplication
{
internal class TCA
{
[STAThread]
private static void Main(string[] args)
{
try
{
ArrayList List = new ArrayList();
List.Add(1);
List.Add(2);
Console.WriteLine("Passing the array:");
Test(List);
foreach (int i in List)
{
Console.WriteLine(i);
}
Console.WriteLine("\nPassing the array as a ref parameter:");
Test(ref List);
foreach (int i in List)
{
Console.WriteLine(i);
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
#region Pause
Console.WriteLine();
Console.WriteLine("Done.");
Console.ReadLine();
#endregion
}
private static void Test(ArrayList list)
{
list.Add(3);
list.Add(4);
}
private static void Test(ref ArrayList list)
{
list.Add(5);
list.Add(6);
}
}
}
|
|
|
|
|
Don't use ref unless you need it.
You only need the ref keyword if you want to change the actual variable that is used to call the method, not just the contents of the variable. Here is an example of when you would need the ref keyword:
private static void CreateList(ref ArrayList list) {
list = new ArrayList();
}
However, there is almost never any real need for the ref keyword. It's mostly used in procedural programming, seldom in object oriented programming.
The method that creates a list can be written like this, which will also make it clearer:
private static ArrayList CreateList() {
return new ArrayList();
}
---
It's amazing to see how much work some people will go through just to avoid a little bit of work.
|
|
|
|
|
Thank you for making the use of ref more clear to me I appreciate it.
|
|
|
|
|
I want to upload some multimedia file to my website. Just like Youtube does. However, I searched google and didn't find any samples. It seems like there is a control called CSUpload Controls in .Net 2.0. But not sure whether it can load video file.
|
|
|
|