thanks for your reply.
I debug my code, there is no error in my code that try block catch it!.
I told everything is alright. the function return return zero ( no error)
I just can't step in to db context. actually debugger can't do it.
I will upload whole project, if there is no problem take a look at it, and debug only server side program.
U can put a check point in CammandReceived line.
In client side I just complete new user. Please try create new user form.
No thanks, nobody is going to download and debug your project for you, it is your job. Now start by improving your code, give it better observability, and if any problems are left, ask specific questions here with sufficient detail.
I found my problem.
I explain my answer to other people may have problem as same as me!
Actually I ( visual studio) make 2 DB file, first one is my solution folder,
and second one was in Bin/debug folder.
when I run or debug my program, data saved in bin/debug folder...!
but when I look at my DB by Visual Studio, it show Solution Database file that contain nothing.
I think it is a bug because I foolish myself for five days for nothing
It's not a bug. What you have here is a limitation in your understanding of the build/run process in Visual Studio. If you look at your database in Solution Explorer, the properties have been set to Copy Always in the Copy to Output Folder dropdown.
I'm not a stalker, I just know things. Oh by the way, you're out of milk.
I need some help. Would u guys mind helping me out on my new project? that's if your're not busy. Our project is somewhat similar to the one that has been submitted here in codeproject. Our project is about simulating a robot ball gatherer. The robot will gather the ball depending on the color and place it back inside a box that corresponds to the color of the ball. Obstacle avoidance is also present. And the robot's speed will gradually slow don until it reaches the ball. I would really appreciate if you will help me on this. I have been coding for 2 weeks already, and I can't even start the robot move. tsk. It's kinda hard especially for me as a second year student. Thank you very much in advance and hope I can hear from you soon.
The Coding4Fun[^] blog often features articles on building robots, using various techniques. Most of the articles are complete walkthroughs, and it's nice to have a material-list and an indication of the cost.
Surprisingly, I have never had to do this before until now. I figured it would be a property of the column, but I am having difficulty determining how to do this. The GridView is populated at run time.
The "dt" prefix suggests that you're setting the Columns of the DataTable to readonly. The link that I posted set the readonly property on the Columns of a DataGridView. Both are possible, and seem to work correctly from a test-project;
Assuming that you are asking about a WPF/SilverLight component, all items in GridView retain attributes of their cell templates. For example, if you used TextBlock in your data template, you'd set its IsEnabled property to "False" to gray out the column.
DataGrid, on the other hand, lets you set properties on individual columns (very much in line with what you described). For example, DataGridTextColumn and DataGridTemplateColumn have an IsReadOnly property that you can set in XAML.
EDIT: It looks like you were not talking about WCF after all
It writes to the log file every 2 seconds, so I know it is looping, but it does not stop the shutdown executable from running. However if I loop it with a batch file it works perfect? Is there a way to have the command text write to the console window as well?
Thanks for reading.
staticvoid Main(string args)
System.Diagnostics.ProcessStartInfo shutDownBlocker = new ProcessStartInfo();
shutDownBlocker.FileName = @"c:\windows\system32\shutdown.exe";
shutDownBlocker.WindowStyle = ProcessWindowStyle.Normal;
shutDownBlocker.Arguments = " /a";
shutDownBlocker.CreateNoWindow = false;
File.AppendAllText(@"c:\temp\shutdownlog.txt", "ran command" + System.Environment.NewLine);
As per my understanding to the question, you have only created the object of ProcessStartInfo and assigned some values to it.
you need to call the Process.Start() API of Process class with object of ProcessStartInfo as a parameter.
Then and only then your 'shutdown.exe' will start and perform its duty.
Hi Praveen, that looks to be my problem, thank you very much.
I'm trying to incorporate it into a service I am building and it just does not work. I am probably overlooking something again, if you have any ideas, I'd love to hear them.
Thank you again for the help.
class WindowsService : ServiceBase
///<summary>/// Public Constructor for WindowsService.
/// - Put all of your Initialization code here.
///</summary>/// Thread thread = new Thread(new ThreadStart(shutDownBlocker));
this.ServiceName = "AllinOneService";
this.EventLog.Log = "Application";
// These Flags set whether or not to handle that specific// type of event. Set to true if you need it, false otherwise.this.CanHandlePowerEvent = true;
this.CanHandleSessionChangeEvent = true;
this.CanPauseAndContinue = true;
this.CanShutdown = true;
this.CanStop = true;
///<summary>/// The Main Thread: This is where your Service is Run.
///<summary>/// Dispose of objects that need it here.
/// or not disposing is going on.</param>protectedoverridevoid Dispose(bool disposing)
///<summary>/// OnStart(): Put startup code here
/// - Start threads, get inital data, etc.
///</summary>///<paramname="args"></param>protectedoverridevoid OnStart(string args)
//Thread thread = new Thread(new ThreadStart(shutDownBlocker));
///<summary>/// OnStop(): Put your stop code here
/// - Stop threads, set final data, etc.
///<summary>/// OnPause: Put your pause code here
/// - Pause working threads, etc.
///<summary>/// OnContinue(): Put your continue code here
/// - Un-pause working threads, etc.
///<summary>/// OnShutdown(): Called when the System is shutting down
/// - Put code here when you need special handling
/// of code that deals with a system shutdown, such
/// as saving special data before shutdown.
///<summary>/// OnCustomCommand(): If you need to send a command to your
/// service without the need for Remoting or Sockets, use
/// this method to do custom methods.
///</summary>///<paramname="command">Arbitrary Integer between 128 & 256</param>protectedoverridevoid OnCustomCommand(int command)
// A custom command can be sent to a service by using this method://# int command = 128; //Some Arbitrary number between 128 & 256//# ServiceController sc = new ServiceController("NameOfService");//# sc.ExecuteCommand(command);base.OnCustomCommand(command);
///<summary>/// OnPowerEvent(): Useful for detecting power status changes,
/// such as going into Suspend mode or Low Battery for laptops.
///</summary>///<paramname="powerStatus">The Power Broadcast Status
/// (BatteryLow, Suspend, etc.)</param>protectedoverridebool OnPowerEvent(PowerBroadcastStatus powerStatus)
///<summary>/// OnSessionChange(): To handle a change event
/// from a Terminal Server session.
/// Useful if you need to determine
/// when a user logs in remotely or logs off,
/// or when someone logs into the console.
///</summary>///<paramname="changeDescription">The Session Change
/// Event that occured.</param>protectedoverridevoid OnSessionChange(SessionChangeDescription changeDescription)
System.Diagnostics.ProcessStartInfo shutDownBlocking = new ProcessStartInfo();
shutDownBlocking.CreateNoWindow = true;
shutDownBlocking.FileName = @"c:\windows\system32\shutdown.exe";
shutDownBlocking.WindowStyle = ProcessWindowStyle.Hidden;
shutDownBlocking.Arguments = "/a";
//MessageBox.Show("shutDownBlocker thread started");
catch (Exception ex)
//MessageBox.Show("Error message in shutDownBlocker thread. Message reads " + ex.Message);
On top of what the other people said, this little technique you're using will only stop a shutdown IF it was initiated with the SHUTDOWN.EXE command. If you shutdown the system with Start -> Shutdown, or some other method other than Shutdown.exe, this code won't do a thing to stop it.