|
Hi,
I want to execute a dos command without using .bat files in C#.net application.plz reply....
Thanks in advance
Smithakrishnan
|
|
|
|
|
try this :
<br />
Process dosapp= new Process();<br />
<br />
dosapp.StartInfo.FileName = "dosapp.exe";
dosapp.StartInfo.Arguments = "/?";
<br />
dosapp.Start();<br />
|
|
|
|
|
When I'm trying to debug the sorce code downloaded from the following site, I got the exception, "An error occurred: Cross-thread operation not valid: Control 'stbMessage' accessed from a thread other than the thread it was created on."
"http://www.codeproject.com/KB/game/tictactoenetwork.aspx",
When I made exe to the solution, its working very fine.
Please guide me to debug the code.
Thanks and Regards,
Lalitha.
|
|
|
|
|
Winforms controls are not thread safe. If you must update a control from another thread of execution, you should use a delegate and then call this.Invoke() from the form.
Cheers,
Vikram.
"I will put my new found knolage to good use" - Captain See Sharp.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.
|
|
|
|
|
Can any one help how to validate system's user name and password?
|
|
|
|
|
Hi: can anyone tell me how to set up an input class for XNA that works? I thought I've done it right, but when it checks input, nothing happens. (So far, it's only supposed to exit) I just want the basic idea o how I would go about doing this, even though it's simple. (I have Game1 class and Input class)
Thanks in advance.
- I love D-flat!
|
|
|
|
|
|
Hi all,
I have write a service to automate a server application. To start the application I need some IPs which are stored in a database. I read the database and get required IPs on my service and run the server.
Up to now everything is ok.
Now I want to check that there is multiple instance are available. Because I can start only one server at a time. To do this I try to use MUTEX, as in C++(my server is written on C++). Can you guys give me a help. I don't know that higher concepts to handle in C#.
Thanks a lot.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Eranga Thennakoon wrote: Now I want to check that there is multiple instance are available.
Multiple instance of what? I don't think you can have multiple instances of a Windows service anyway. If it's a regular app that you only want one instance of, C# has a Mutex in System.Threading which fits the bill. Google is your friend[^]
Cheers,
Vikram.
"I will put my new found knolage to good use" - Captain See Sharp.
"Every time Lotus Notes starts up, somewhere a puppy, a kitten, a lamb, and a baby seal are killed." - Gary Wheeler.
|
|
|
|
|
hello,
my web app use DirectoryServices to query Active Directory. On customer side i'm getting following error:
The time limit for this request was exceeded.
This error appears ~2 minutes (~120 s) after method FindAll() had been launched. Google this error description i found:
Active directory queies can take a bit of time to process so you may have to extend the time available from the default. You can do this by adding a <httpruntime> section to the web.config file with an executionTimeout attribute. Take a look at
<a href="http://msdn2.microsoft.com/en-us/library/e1f13641.aspx">http:
default value for executionTimeout attribute is 110 seconds. So it seems my error appears because of timeout.
BUT customer says - other LDAP tools didn't produce such error, and find objects quickly.
So, why is my search too sloooooooow?
thanks,
max
|
|
|
|
|
What OS? When I wrote some LDAP code on Windows 2000 using COM a while ago it was blazing. Then I executing the same thing on XP and it would take about 10 minutes. I never did figure out the problem.
Need a C# Consultant? I'm available.
Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway
|
|
|
|
|
I don't know exactly but I suppose Win 2003
thanks,
max
|
|
|
|
|
Dear All,
I have a treeview with several parent and child node. If I click on a parent, I want to invoke a method. If I click on a child , I want to invoke another method. The same method for the parents , and the same method for the childs.
+ Parent Node 1
- Child node 1
- Child node 1
+ Parent Node 2
- Child node 1
This is the code I dreamed to achieve this. But .. for some reason it doesn't work. If I click on the child, it works .. however, the parent method is not fired when I click on the parent. Can somebody point me in the right direction with whatever it is that I'm doing wrong ?
private void treeView_AfterSelect(object sender, TreeViewEventArgs e)<br />
{<br />
if (e.Node.Parent.IsSelected)<br />
{<br />
MessageBox.Show("This is the parent node");<br />
}<br />
<br />
else<br />
{<br />
MessageBox.Show("This is a child node");<br />
}<br />
}
Thanks
|
|
|
|
|
Do you mean the after select event is not fired, or do you mean that the wrong message box shows ?
I'd probably set the tree view items up with tags so you can tell what level they are on. Or check if the node has children, if the tree is only ever one level.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian,
Thank you for replying so quickly. The Afterselect is actually being called, and the second Messagebox ( when selecting a child ) comes up correctly .. but the first one isn't. Selecting a child with my code works fine, but not the parent. To me , that doesn't make sense, as it really checks if the parent is selected or not, or else it wouldn't make it to the else section and show the child messagebox.
Rick
|
|
|
|
|
Obviously this means the check is not doing what you expect it to. So, set a break point and look at the properties of the event args. As I said, I think that checking if the selected node has children looks like the easiest way to do what you're after.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian ,
I guess your right. I changed a bit in my code , and now it works fine :"
private void treeView_AfterSelect(object sender, TreeViewEventArgs e)<br />
{<br />
if (e.Node.Level == 0)<br />
ClearAll();<br />
else<br />
FillDaTree();<br />
}
I'm very curious to know what the diff is between e.Node.Parent.IsSelected and e.Node.Level == 0
Cheers,
Rick
|
|
|
|
|
Well,
I do know that difference as e.Node.Parent.IsSelected would only go up until it reached the parent of the child node, which could several levels deep, while e.Node.Level == 0 would got to the actual root node at level 0. But in a treeview with a parent at level 0 , and a child at level 1 , should just work.
|
|
|
|
|
Hi Rick
if (e.Node.Parent.IsSelected)
{
MessageBox.Show("This is the parent node");
}
This piece of code doesn't make sense in the context of an AfterSelect handler. By definition e.Node is selected therefore it's parent, e.Node.Parent, is not and e.Node.Parent.Selected will always be false.
AlanN
|
|
|
|
|
Hi,
I'm quite new to c# and OOP in general.
I have a situation where I am parsing an xml file and creating objects based on what I find there. What I want to do is name any object or struct I create using the name attribute from my element. I have assigned the current name attribute to a string variable. How do I know use that to name my object to the value of that string?
Thanks for any help.
Neil
tsd
|
|
|
|
|
You can't do that, and even if you could, how would you use a variable that you don't know exists?
Use a collection to store your objects, like:
Dictionary<string, MyClass> items = new Dictionary<string, MyClass>();
items.Add(name, new MyClass(something));
MyClass item = items[name];
Experience is the sum of all the mistakes you have done.
|
|
|
|
|
Here is a simple question for you C# Gods. How do you pass arrays -- specifically, an array of integers of unknown length -- as arguments to methods in C#?
|
|
|
|
|
Xarzu wrote: How do you pass arrays -- specifically, an array of integers of unknown length -- as arguments to methods in C#?
Use the params keyword.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Why can't you just pass an int[] ? Personally, I'd use a List<int>
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Just do something like
void MyFunction(int[] myarray)
{ }
and call it like this
int[] arr = {2,4,6};
MyFunction(arr);
You can also use the params keyword which allow you to pass the elements as parameter as well as the former way.
Let's say something like
void MyFunction(params int[] myarray)
{ }
call it either
int[] arr = {2,4,6};
MyFunction(arr);
or
MyFunction(2,4,6);
|
|
|
|