|
USE A LOOP AND STOP ASKING TWICE IN 2 DAYS, YOU ALREADY GOT HELP. FUCK BOLD TEXT IS ANNOYING, ISN'T IT!!!!!!!!!!!!!
|
|
|
|
|
|
this is your original thread[^]. Notice the missing posts? Those are yours. Way to delete them, that way if someone comes and actually searches the forums for a problem similar to yours, they won't find it. Because you're an asshat.
Secondly, read this[^] now that you've posted more then 5 times, you still don't follow those rules and if you post more then 5 time's, you really should be able to by now.
You received an answer in your previous thread, do not ask again until you try something new and get stuck there, you have not rendered any additional code or attempted a new method to accomplish your task, so the old answers still stick.
|
|
|
|
|
you are right.
Excuse me
|
|
|
|
|
NO! STUPID F* WHO CAN'T THINK ARE ANNOYING!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
problem solved.
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
class MainClass
{
public static void Main(string[] args)
{
string inFile;
string line;
const string inDir = "D:\\data\\A\\";
const string outDir = "D:\\data\\B\\";
DirectoryInfo di = new DirectoryInfo(inDir);
FileInfo[] files = di.GetFiles("*.txt");
foreach (FileInfo fi in files)
{
inFile = fi.FullName;
StreamReader sr = File.OpenText(inFile);
List<string> lines = new List<string>();
while ((line = sr.ReadLine()) != null)
{
lines.Add(line);
}
int numberOne = Int32.Parse(lines[0]);
int numberThree = Int32.Parse(lines[2]);
int x = numberOne + numberThree;
sr.Close();
string destFile = Path.Combine(outDir, fi.Name);
File.WriteAllText(destFile, Convert.ToString(x));
}
}
}
</string></string>
|
|
|
|
|
I have opened a exe file using
System.Diagnostic.Process.Start("filename");
I want to close the opened exe file..
How do i go about it
Thanks for any help in advance
|
|
|
|
|
If you don't have the process handle, use Process.GetProcesses(); to get all running processes, search for your process, and destroy by using Kill() method.
Calin
modified on Wednesday, February 18, 2009 11:46 AM
|
|
|
|
|
Here is your solution:
using System.Diagnostics;
...
Process newProc;
newProc = Process.Start("filename");
...
newProc.CloseMainWindow();
The newProc.CloseMainWindow() method is used for Window apps. For Console apps use the newProc.Kill(); method instead.
|
|
|
|
|
Hi,
I used
proc.CloseMainWindow();
for closing the exe file.
It works well, but i have opened more than one exe file.
This code does not work for that case..
|
|
|
|
|
for more then one process, you can use List<Process> procList = new List<Process>(); and you can manipulate all of the started processes individually.
List<Process> procList = new List<Process>();
...........
Process newProc;
newProc = Process.Start("filename1");
procList.Add(newProc);
newProc = Process.Start("filename2");
procList.Add(newProc);
...............
foreach (Process p i in procList)
p.CloseMainWindow();
Hope this helps!
modified on Thursday, February 19, 2009 4:44 AM
|
|
|
|
|
Hi,
It works well..
Thanks for the help
|
|
|
|
|
You welcome!
|
|
|
|
|
hi
Any idea on how to draw a line similar to the one present in ms word, the line can be rotated about 360 degrees and also it can be resizable, movable. It should be like a control with all events. Please let me know if there is any way to do this. Sending Source code is also fine with me.
any article talking about this ??????
thanx
|
|
|
|
|
You would have to create a custom control (one is not yet created like this). You would have to add events for when the ends are clicked so that it can be resized or rotated. In the drawing events you will have to draw the line based on the properties that are altered in the events (ex: angle of line, x1,y1,x2,y2,color,etc).
Regards,
Thomas Stockwell
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.
Visit my Blog
|
|
|
|
|
Please help me to compare the length and lines of data in 2 files which are inside a zip file.
File2:Will have details about the each file length which is inside the zip file
File1-Any file .dat file
File2-MRR_GIQ_FR_X03_M0808_STATS.dat
using System.Text;
using System.IO;
using System.IO.Compression;
namespace ConsoleApplication1
{
class Class1
{
public bool splitFile = false;
string srcFile = "C:\\SampleFile\\MRR_Files.zip";
static void Main(string[] args)
{
TestDecompress();
}
private bool FileCompare(string file1, string file2)
{
int file1byte;
int file2byte;
FileStream fs1;
FileStream fs2;
// Determine if the same file was referenced two times.
if (file1 == file2)
{
// Return true to indicate that the files are the same.
return true;
}
// Open the two files.
fs1 = new FileStream(file1, FileMode.Open);
fs2 = new FileStream(file2, FileMode.Open);
// Check the file sizes. If they are not the same, the files
// are not the same.
//if (fs1.Length != fs2.Length)
//{
// // Close the file
// fs1.Close();
// fs2.Close();
// // Return false to indicate files are different
// return false;
//}
// Read and compare a byte from each file until either a
// non-matching set of bytes is found or until the end of
// file1 is reached.
do
{
// Read one byte from each file.
file1byte = fs1.ReadByte();
file2byte = fs2.ReadByte();
}
while ((file1byte == file2byte) && (file1byte != -1));
// Close the files.
fs1.Close();
fs2.Close();
// Return the success of the comparison. "file1byte" is
// equal to "file2byte" at this point only if the files are
// the same.
return ((file1byte - file2byte) == 0);
}
|
|
|
|
|
Please use the pre tags, the code is unreadable right now.
And what exactly is your question?
|
|
|
|
|
Question:- I have one Parent domain called PDomain, and two child domains Child1, Child2. Child1 has a user called John. Child2 has a role called Developers. Now John is added as a member of group Developers.
When I try to get all roles for John, it never returns Developers.
Following is the code I am using to search:-
DirectoryEntry entry=new DirectoryEntry(Path);
DirectorySearcher mySearcher= new DirectorySearcher(entry);
mySearcher.Filter = "(&(objectClass=user) (cn=John))";
mySearcher.PropertiesToLoad.Add("memberOf");
SearchResult myresult = mySearcher.FindAll();
The issue is, Path I send as Child1, it does not have the role assigned, and if I send the path as Child2, it is not able to find the user.
I have tried using mySearcher.SearchScope = SearchScope.OneLevel; or subtree also. Nothing works.
Any idea anyone?
Nana
|
|
|
|
|
Dear all,
I am doing some screen scraping work and I am making a web request to web page that is encoded in IS0-8859-1. In order to be able to get the special characters such as the apostrope correct, I had to change the encoding of the response to windows-1252.
The following is my web request/response code:
public static string GetHTMLStringWin(string url)
{
StringBuilder html = new StringBuilder();
string htmlToRet = null;
try
{
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
request.Timeout = 30000;
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
Stream htmlStream = response.GetResponseStream();
string temp = null;
byte[] buffer = new byte[9000];
int counter = 0;
do
{
counter = htmlStream.Read(buffer, 0, buffer.Length);
if (counter != 0)
{
temp = Encoding.GetEncoding("windows-1252").GetString(buffer, 0, counter);
html.Append(temp);
}
}
while (counter > 0);
htmlToRet = html.ToString();
}
catch
{
htmlToRet = null;
}
return htmlToRet;
}
The apostrophe is interpreted well using this method, however i am getting unwanted dashes in the text. For example the word periti is becoming pe-ri-ti. I believe that this has to be some encoding issue. The target webpage is interpreted correctly in a web browser.
Any suggestions of how may I solve this?
Many thanks,
Chris
|
|
|
|
|
I have created a windows service to upload a power point presentation. And i have created a web application to use that service to upload the presentation. But in windows service while creating instance of power point presentation application i am getting this error
Retrieving the COM class factory for component with CLSID {91493441-5A91-11CF-8700-00AA0060263B} failed due to the following error: 80070005.
I gave the aspnet user permissions to that directory also. and i tried impersonation=true in web applications web.config file. Still i am getting problem. can u suggest how to solve it?
Thanks in advance
|
|
|
|
|
our form has many controls thar are supposed to be connected wiyh eadch other with lines in specific way how can we write code to draw a line that connects btwn two controls without crossing the other existing controls
thanks
|
|
|
|
|
There's no easy solution to that. Its pretty trivial to draw a line on a form, just override the OnPaint method and draw away, but to avoid certain regions will require some quite complex path-finding code.
Is there not a better solution for you? It strikes me that a form with lines connecting things all over the place would get unweieldly very quickly.
|
|
|
|
|
As said, you need to use the OnPaint event and a graphics object. You also need to have the location(top, left, right and bottom) for each control and bend lines accordingly.
More than C#, I think you will need coordinate geometry.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|
|
Hi All
I am working with datagridview. I have added DatagridviewComboBoxColumn in my datagridview. now i need to findout that combobox (like in asp.net we find it using findcontrol() method. is there any method or any other way to find it.
Thanx in advance
Nitin
|
|
|
|
|
In OnRowDataBound event you may search for it, use something like e.Row.Cells(Index).FindControl()
Calin
|
|
|
|