|
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
|
|
|
|
|
Is there any OnRowDataBound event in windows application?
I am using datagridview in windows appication not gridview in web based appln
thanx
|
|
|
|
|
Sorry, my mistake, I had the impression that I was posting in ASP.NET forum.
Calin
|
|
|
|
|
What exactly do you want to achieve?
You may get the value of the Combo by using
gvd.Rows[rowIndex].Cells[celIndex].Value
Calin
|
|
|
|
|
Hello,
I try to set the installer to always overwrite files during the installation, the Transitive property is set to true on them, but sometimes it doesn't work. Any idea how to make sure the files are overwritten?
Second question,
When i runas /user:admin cmd on non admin account and run the msi package from there, it doesn't fully install. When I run the application after that, it install some additional things, if this is done from non admin account, error message pops up it cannot find the installation package (it was installed from usb stick, if the package is copied to the hdd, error message doesn't show).
Is there any way to avoid such behavior?
Thanks!
|
|
|
|
|
For the first question: Windows Installer has a set of rule to decide if overwrite an existing file. These rules take into account create/modified dates and file version, if there is any.
More details here[^].
|
|
|
|
|
Hi,
Pls tell me How to set user-defined-type as Oracle SP input parameter in .NET 2005 with oracle database 10g client.
example :
I created simple object type
create or replace type TYP_address as object
(
-- Attributes
address VARCHAR2(500),
ZIPCODE Varchar2(5)
)
create table TAB_ADDRESS
(
ADDRESS VARCHAR2(200),
ZIPCODE VARCHAR2(5)
);
create or replace procedure test_udt_sp(obj_address IN TYP_address ) is
begin
INSERT INTO tab_address(address,ZIPCODE) VALUES(obj_address.address,obj_address.ZIPCODE);
COMMIT;
end test_udt_sp;
Now How i call this procedure "test_udt_sp" with what type of input parameter of obj_address.
Pls help me in this.
Thanks in Advance.
Anil
|
|
|
|
|
This thread[^] has the same example you are mentioning, with the answer.
|
|
|
|
|
Hi,
i givng my code below.
I created two types for input and output parameter for a functions.
type get1 as object(deptno number(5))NOT FINAL;
TYPE GET2 AS OBJECT(DNAME VARCHAR2(14),LOC VARCHAR2(13))NOT FINAL;
///Function code :
function getdata(id in get1,data out get2)
return varchar2 is retval varchar(10); begin
select get2(dname,loc) into data from dept where deptno = get1.deptno;
retval := 'Result'; return retval; end;
///My .net code :
OracleConnection con = new OracleConnection("Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=10.0.2.3)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=ORACLE)));User Id=scott;Password=tiger");
OracleCommand cmd = new OracleCommand("getdata", con);
cmd.CommandType = CommandType.StoredProcedure;
GET1 objget1 = new GET1();
GET2 objget2 = new GET2();
objget1.DEPTNO = 10;
GET2[] get22 = null;
OracleParameter outparam = new OracleParameter();
outparam.OracleDbType = OracleDbType.Object;
outparam.Direction = ParameterDirection.Output;
outparam.ParameterName = "data";
outparam.UdtTypeName = "GET2";
outparam.Value = objget2;
OracleParameter inparam = new OracleParameter();
inparam.OracleDbType = OracleDbType.Object;
inparam.Direction = ParameterDirection.Input;
inparam.ParameterName = "id";
inparam.UdtTypeName = "GET1";
inparam.Value = 10;
con.Open();
cmd.ExecuteNonQuery();
when i'm executing the below error is coming.
"ORA-06550: line 1, column 7:\nPLS-00306: wrong number or types of arguments in call to 'GET_DATA_NEW'\nORA-06550: line 1, column 7:\nPL/SQL: Statement ignored"
Pls help me.
modified on Tuesday, February 24, 2009 1:59 AM
|
|
|
|
|
How to override Button Click EventArgs or use another ways to achieve it?
in the button_Click,there is only two parameters(object sender and EventArgs e), now I want to override the Button_Click add
a bool parameter, if the parameter is true then execute this click event, otherwise doesn't execute this click.
It can not be overrided the button1_Click by adding a parameter directly, It seems to be feasible by override the EventArgs,
But I am a novice, and don't know how to achieve this function, if give me detail code,I'll very appreciate your assitance.
Thanks in advance!
|
|
|
|
|
You must be setting the bool parameter somewhere, right? Won't this be solving your purpose?
private void button1_Click(object sender, EventArgs e) {
if (SomeBoolean) {
}
}
Here SomeBoolean is a class level variable.
The word "politics" describes the process so well: "Poli" in Latin meaning "many" and "tics" meaning "bloodsucking creatures."
जय हिंद
|
|
|
|