c#-2.0

Console application not closing

China☆狼群 提交于 2019-12-04 10:05:57
问题 I'm developing a console application that is supposed to run under WinCE 6.0 and WinCE 7.0 . I'm using C# , Compact Framework 2.0 for different compatibility reasons. My application is started by an external runtime called TwinCAT (from Beckhoff). Within this application, my teammate used a function block called nt_startProcess (documentation here) that is in charge of starting my application on demand. My problem - Two different behaviors depending on the OS : When started manually (without

C# Batch plot application (PrintServer & PrintQueue issues)

让人想犯罪 __ 提交于 2019-12-04 09:55:31
I have a problem that I need help with. For my current project I need to make a Batch Plot application. This application will have around ~2000 AutoCAD drawings that it will need to print. The application needs 5 printers, 1 for each format, going from A4 to A0. No problems yet so far. Now we all understand that we can not queue 2000 drawings simultaneously without some kind of trouble. I've did my research online and found methods to look at the current printer Queue. Using PrintServer and PrintQueue. Here is where the problems begin. Firstly I am not able to find the network printers that I

The current identity (NT Authority/Network Service) does not have write access to

≡放荡痞女 提交于 2019-12-04 09:21:05
问题 I developed a simple web application. A label and a button. On click of Button, the label will display Hello World. When I deploy this web application on my web server and access the URL, I get this error message. The current identity (NT Authority/Network Service) does not have write access to C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\ I have tried the following - Navigate to C:\Windows\Microsoft.NET\Framework\v2.0.50727 and typed the following command - aspnet

How do I sort an array of custom classes?

ぐ巨炮叔叔 提交于 2019-12-04 09:12:25
问题 I have a class with 2 strings and 1 double (amount). class Donator string name string comment double amount Now I have a Array of Donators filled. How I can sort by Amount? 回答1: If you implement IComparable<Donator> You can do it like this: public class Donator :IComparable<Donator> { public string name { get; set; } public string comment { get; set; } public double amount { get; set; } public int CompareTo(Donator other) { return amount.CompareTo(other.amount); } } You can then call sort on

How to validate combo box values in c# [closed]

守給你的承諾、 提交于 2019-12-04 05:37:18
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I have 6 combo boxes in c# form that all fill from database from same column. i-e for making student result combo boxes fill subject names. now I want is how to delete Subject name from 2nd combo box if the

How to get a ReadOnlyCollection<T> of the Keys in a Dictionary<T, S>

北战南征 提交于 2019-12-04 04:06:39
My class contains a Dictionary<T, S> dict , and I want to expose a ReadOnlyCollection<T> of the keys. How can I do this without copying the Dictionary<T, S>.KeyCollection dict.Keys to an array and then exposing the array as a ReadOnlyCollection ? I want the ReadOnlyCollection to be a proper wrapper, ie. to reflect changes in the underlying Dictionary, and as I understand it copying the collection to an array will not do this (as well as seeming inefficient - I don't actually want a new collection, just to expose the underlying collection of keys...). Any ideas would be much appreciated! Edit:

Validating WinForms TextBox (in C#)

落花浮王杯 提交于 2019-12-03 23:01:30
问题 In TextBox_Leave event i need to check whether numbers entered in textbox is in serial number or not.If it is not in order then i need to display a message as "number" is missing For example : In textbox i have entered 3 and click tab : I need to display message as "Number is not in order , number "1" and "2" is missing " 回答1: I don't know whether this also works in c#2.0, this is my experience in c#3.0: Why do you use TextBox_Leave for that? The Validating-event should be used for validating

Database Logging with Enterprise Library 5

南笙酒味 提交于 2019-12-03 16:23:28
Anybody knows how to implement database exception logging using EL 5.0? Thanks! You will need to run a script against the database so that it creates a specific table structure for you. Also, there will be a stored procedure that will be created that you will have to reference in the Trace Listener's configuration section. You should be able to find this script file here: C:\EntLib41Src\Blocks\Logging\Src\DatabaseTraceListener\Scripts folder. I know this is for version 4 of the library, but looking into the version 5, I realized that the folder structure has taken a change and the script

Can we add parameter in datatable.select in c#

坚强是说给别人听的谎言 提交于 2019-12-03 16:19:20
I like to know is it possible to add parameter in datatable.select(expression).For example string query="Name=@Name"; //dt is comming from database. dt.Select(query); How to add this parameter @Name . I need to compare a value which contains single quote and it gets failed in the above case. Thanks in advance You can use String.Format , you need to escape single quotes with two: string query = string.Format("Name='{0}'", name.Replace(@"'", "''")); var rows = dt.Select(query); or, if you want to use Like : string query = string.Format("Name LIKE '%{0}%'", name.Replace(@"'", "''")); (note that a

Youtube C# .NET API : Uploading video and getting events when finished

笑着哭i 提交于 2019-12-03 16:03:51
This is the code to upload a video to Youtube using the C# .NET API from a Windows Forms desktop application: YouTubeRequestSettings settings = new YouTubeRequestSettings("whatwill come here ?", "my api key", "my youtube login email", "my youtube login password"); YouTubeRequest request = new YouTubeRequest(settings); Video newVideo = new Video(); newVideo.Title = "test 1"; newVideo.Tags.Add(new MediaCategory("Gaming", YouTubeNameTable.CategorySchema)); newVideo.Keywords = "test 1 , test 2"; newVideo.Description = "test 3 test 4"; newVideo.YouTubeEntry.Private = false; newVideo.Tags.Add(new