C# 4.0 Strange FormatException after upgrading in VS 2010

I get this FormatException after i upgraded to VS 2010. Not anything really special. Code: private void ManageDateEditControls() { apoDateEdit.DateTime = DateTime.Parse(string.Format("01/{0}/{1}", DateTime.Now.Month-1, DateTime.Now.Year)); eosDateEdit.DateTime = DateTime.Parse(string.Format("{0}/{1}/{2}", GetLastDayOfMonth(DateTime.Now.Month + 1), DateTime.Now.Month - 1, DateTime.Now.Year)); <-- FormatException occurs in this line. } private static int GetLastDayOfMonth(int

C# 4.0 Temporarily removing impersonation

I'm using the following code to impersonate a different user. http://www.codeproject.com/KB/cs/zetaimpersonator.aspx The problem is that I also need to call a local executable. When attempting to access the .exe I'm getting the error "Access Denied". I've tried adding the impersonated user to the file permissions but that didn't appear to work. So my question, is there an easy way to break out of the impersonated user and come back in? I'm open to other suggestions as well.

C# 4.0 Return newly created TFS work item ID using TFS API?

Using the TFS API, I am able to create a TFS item, no problem. What would be the best way for me to know what the Item ID is for the newly created Item? Thank you, George try { // Authenticate User Account NetworkCredential account = new NetworkCredential(USERNAME, PASSWORD, DOMAIN); // for user stories from the team project where the user story will be created. Uri collectionUri = new Uri(tfsURI); //TfsTeamProjectCo

C# 4.0 C# Application for Sattelite TV and Logo/scrolls

I want to develop an application (basically a media player with additional features). What i want is: Play specified videos ( i.e Local video or satellite TV eg. HBO, NAT GEO etc) Show Logos on top right/left corner Play scrolls ( like news scroll being played on CNN on the bottom of the screen ) L-Shaped Ads ( sometimes and on some geographical regions they are played oftenly during cricket matches ). Basically the transmission is skewed to some size. Then the region freed up by skewing is f

C# 4.0 Log4Net section in Web.Config generates Error

So I am trying to set up Log4Net in my Web .NET 4.0 application. I have added the correct .dll to my project and have appended the following to my Web.Config file as starters: <configSections> <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/> <root> <level value="DEBUG" /> <appender-ref ref="RollingLogFileAppender" /> </root> </configSections> <log4net debug="true"> <appender name="RollingLogFile

C# 4.0 Packet Details Markup Language

I have problem in parsing XML containing gsm packets through my .Net application.I want to decode data obtained from parsed XML as wire shark Decode.Problem is,That my information regarding gsm packets and protocols is limited. I read somewhere that wire shark parse xml through PDML(Packet Details Markup Language) File which contains all the information of all types of protocols including gsm. I googled but not found that file. Any help and Suggestions will be appreciated

C# 4.0 Dependency injection into a static class

Possible Duplicate: Configure Property of a static class via spring .net I want to inject the value for a property inside the static class using spring .net. Code snippet: Public static Abc { Public static IInterface IInterface{get;set;} } here i want to inject the IInterface value inside the Abc staic class though spring .net config.

C# 4.0 Ninject, passing constructor argument to the kernel

Here is my problem: I want to pass in one of the values to the constructor every time I request an instance form the kernel. I written some code below to illustrate the problem. The test is not failing so I guess that this works, but it does look pretty ugly. Is there a better, cleaner way to accomplish this with Ninject? Or should I rethink my design? All suggestions are appreciated. [TestFixture] public class Sandbox { [Test] public void Run_Forrest_Run() { using (var kern

C# 4.0 access to entity join result by foreach?

i have 2 table and make this join it works fine and i can bind it to a datagrid view (in winforms) but how can i access to result data by foreach (how can i access to row[0][1] like data tables)?? void Testmethod() { IEnumerable<object> result; using (var context = new TestDBEntities()) { result = (from a in context.Table1 join b in context.Table2 on a.ID equals b.Id select new { b.Id ,b.name

C# 4.0 License Agreement for XNA program

I was just wondering what license agreement I should include in an XNA Framework game set-up file. Currently, I'm using GNU license, but I'm not sure if this is appropriate or not... I just want to make sure that I am using the correct agreement, or if it is suitable enough to cover this.

C# 4.0 XML serialization and deserialization

I receive an XML file from a server, which contains many elements, and one attribute. When Try and serialize/deserialize the xml, all the elements are serialized/deserialized properly, except for the attribute. Why does this happen? here is the XML file: "<msg><msisdn>123456789</msisdn><sessionid>535232573</sessionid><phase>2</phase><request type=\"1\">*120*111#</request></msg>" and the class: [Serializable] [XmlRoot(ElementName

C# 4.0 SecurityAction.RequestMinimum is obsolete in .Net 4.0

Recently, our .Net client libaray is upgrading to compile against Net 4.0. After change the target framework to 4.0, the application has some compilation error. In AssemblyInfo.cs: [assembly: SecurityPermission(SecurityAction.RequestMinimum, Execution = true)] Error 7 Warning as Error: 'System.Security.Permissions.SecurityAction.RequestMinimum' is obsolete: '"Assembly level declarative security is obsolete and is no longer enforced by the CLR by default. See http://go.microsoft.com/fwli

C# 4.0 Rebuilding MP4 file from fragmented MP4 "mdat" atom?

I'm trying to rebuild a video file from a Smooth Streaming server. Smooth Streaming serves fMP4 files which are regular MP4 files without neither their FTYP nor their MOOV atoms. All the informations stored in those atom are placed into a Manifest XML file, which I have. Is there a way to programmatically rebuild the original MP4 file, either by: rebuilding a new file straight from H264/AAC content located in MDAT (and picture format infos); or rebuilding FTYP and MOOV atoms Or else, is th

C# 4.0 The input is not a valid Base-64 string as it contains a non-base 64 character

I am struggling since last 2-3 days in finding out the resolution for below exception: The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or a non-white space character among the padding characters. I searched for similar questions and found answers but none of them work for me. Here is the data which I am trying to convert: {\"Package\":[{\"Faq\":[{\"FaqId\":1,\"AppId\":65,\"Title\":\"Test1\", \"Description\":\"Test1\",\"IsRemo

C# 4.0 Date in X-Axis - .Net Charts

i am working in .Net Charts. i want to show date in X-Axis. For ex : if i select Last 52 Weeks, then i should show the chart for last 52 weeks, whereas those 52 weeks start date should be in x-axis. I am not having any idea, how to do this..I had tried with the code.. DateTime Frm = sessionManager.ChartViewPeriodFrom; DateTime To = sessionManager.ChartViewPeriodTo; double min = Frm.ToOADate(); double max = To.ToOADate(); Chart1.ChartAreas["ChartArea1"]

C# 4.0 SignedXml.CheckSignature(key) always throws error

I am new to C#.NET programming. With help of online references, I have written the code below to verify signature of a SAML assertion (generated by a server API). My Env: VS 2010 Ver4.0 Win XP SP3 SAML Assertion token looks something like this:* <saml:Assertion xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion" Version="2.0" ID="idGYEv...USb8GfnqF" IssueInstant="2012-12-05T14:13:39.00Z"> <saml:Issuer Format="urn:oasis:names:tc:SAML:2.0:nameid-format:entity">http://noszti...xyz.com

C# 4.0 Using Range.TextToColumns to convert to multiple columns does not work

My goal is to convert a single csv string to multiple columns in excel using Range.TextToColumns(). I have a csv file whose columns can contain commas inside them, in that case the column value has double qoutes around it. So to avoid that issue I am just spliting at end of lines to get individual rows. My plan is to put each csv row in a single cell in each excel row and use Text to columns function to get my column values staright a way without worrying about the commas inside column value

C# 4.0 Quick Book 2006 with windows 7

I am using quickbook 2006 premium edition with windows 7. Now when i am trying to connect quickbook with c#.net i got the following error on QBSessionManager. Retrieving the COM class factory for component with CLSID {178AACCA-9DCE-42A0-A193-CF4985B930E5} failed due to the following error: 80070005 Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)). My code is like : public test() { InitializeComponent(); sessionManager = new QBSessionManager(); }

C# 4.0 Create Pocos for Petapco with data (results) from stored procuders

I realy like PetaPoco, and I am at early beginning of using it. My database server is MSSQL2008R2, and I there is havy use of stored procedures. I learned how to create Pocos from (for) tables . Is there an easy way to create Pocos from already written stored procedures which returning data back from SQL serve.

C# 4.0 signalR 500 internal server error

I've been struggling for quite a while now trying to get my console client app connecting to my console server app. So far i'm getting 500, "There was an error opening the connection .." I'm not sure its even getting to the server. although it seems that the server is listening Do you have any idea why it happens? Server My Hub: [HubName("server")] public class HubImpl : Hub { public string Hello() { return "Hello there!"; } } My WebApplication wrapper: public class H

C# 4.0 how to send a message in multicast group (wired to wireless)

my project is to let two devices communicate with each other, one is a laptop and the other one is a desktop, using Sockets class in c#. The laptop is connected to the router via wireless connection while the desktop is connected to LAN or Wired connection to the same router. The problem is when i let my laptop send data to the desktop, the desktop does not received any data. But when i tried sending a message via another laptop connected via wireless connection it first laptop are able to rece

C# 4.0 Close Any Dialog/MessageBox From C# applications

We are working on .NET environment. Mainly my applications having operation on microsoft files(open/close/save) As there are many message box prompt comes while opening few microsoft files. So user has to close this dialog manually and then it will start processing next file. So is there any way, we can perform our process without any message box interruption ? Or is there a way, we can close any dialog/messagebox from C# code ? Thanks

C# 4.0 How to copy MS office dll to local folder

I need to copy MS office dll from following references paths and this is my client asked. Can I do this? If yes, How?? C:\Windows\assembly\GAC\Office\12.0.0.0__71e9bce111e9429c\Office.dll C:\Windows\assembly\GAC\Microsoft.Office.Interop.Excel\12.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.Excel.dll

C# 4.0 How to empty textbox befor ModalPopupExtender show?

My code is to insert the text from textbox, I did my code well but I want to empty the textbox before ModalPopupExtender show. I did my code but It didn't work. protected void Btn_monthlyemployee_Click(object sender, ImageClickEventArgs e) { var Comment = (TextBox)((ImageButton)sender).Parent.FindControl("txt_monthlyemployee"); ftier.Addcomment(LblMonthlyPID.Text, LoggedUserID, txt_monthlyemployee.Text, DateTime.Now, DateTime.Now, false); Comment.Text = string.Empty; ModelEx

C# 4.0 Pdf print without opening in C#

I'm try to print PDF without opening in adobereader. File print successfully, but adobereader open as a window. I want to stay close state that window. this is my code.. ProcessStartInfo info = new ProcessStartInfo(System.Web.HttpContext.Current.Server.MapPath("~/Reports/invPrnt.pdf")); info.Verb = "Print"; info.CreateNoWindow = true; info.WindowStyle = ProcessWindowStyle.Hidden; Process.Start(info);

C# 4.0 How to remove value from datagridview cell on cell click?

I have a datagridview column which value is showing 0.00 when form load which is a decimal value. I want to clear this column cell value when I click on particular cell and when I leave the cell the value(0.00) should come in the cell. I am attaching a snap shot for better understanding. I want this on particular cell click. Is it possible with decimal values? How can I set a cell as empty? I have done some code on cell click but no result. private void dgvForecast_CellClick(object sender,

C# 4.0 Windows Store apps fileopen picker

I want to custom the fileopen picker. For example the user only allow to access to the particular folder only instead the user can choose anywhere it want. How do I do that ? Thanks.

C# 4.0 Find missing columns in data table

I am trying to fetch an XML response and I am filling the data table with the response. My requirement is that I need to find missing columns from that data table. Currently I am applying following logic: if (!dtInstr.Columns.Contains("ABCD") && !string.IsNullOrWhiteSpace(dtInstr.Rows[0]["ABCD"].ToString())){ missing_fields += "ABCD, "} With the above logic, as the number of columns increase, I need to write extra logic which can be quite cumbersome. Please let me k

C# 4.0 How to assign values to a property whose name is in a string?

I want to assign value to the property of the object of class. I have taken the list of property names using GetProperties(); PropertyInfo [] props; props=typeof(Import_Column).GetProperties(); I have created an object Import_Column myobj=new Import_Column(); I want to do something like myobj.props[2]=value; //giving me error How can i do it? is there any different approach?

C# 4.0 Adding formatted text to an existing bookmark

I'm trying to add some formatted text to an existing bookmark. For some reason, the formatting is not working, and the text goes outside the bookmark (right of the bookmark) instead of within the bookmark. This is the code I have so far: var bmkRange = this.bookmark1.Range; object newRangeStart = bmkRange.Start; object newRangeEnd = bmkRange.End; Word.Range r = Range(ref newRangeStart , ref newRangeEnd); // if ( a == b ) // { r.Text = "some text here, "; r.Bold = 0; r.Font.Name = "Verdana";

C# 4.0 Bind an object to class in autofac and object can be null

I am using MiniProfiler in my project. To get an instance of the MiniProfiler, i have to use the following: var profiler = MiniProfiler.Current; This profiler object is what I want AutoFac to pass to every MiniProfiler Type when I create a class. Example I did the following: var profiler = MiniProfiler.Current; builder.RegisterInstance(profiler); and in my controller I use the following way: public ListingsController(IDataFetcher DataFetcher, ILog log, MiniProfiler profiler)

C# 4.0 How to remove default mapping of index without deleting its data of elasticsearch

I have some documents in Couch-base in which some field values are having space in it ("Ex. "New York"). I am not able to search it as exact match using term query. I found that for searching the field values which are have space require some mapping like - index : not_analysed and I have done the same But when I am doing XDCR from couch base to elastic search .Couch base itself creates default mapping.Because of which I am not getting proper result. So, is there any way by which we can delet

C# 4.0 SignalR send same message in different language

I m trying to learn and integrate SignalR in my system. I have one question here. Assuming I have hub created and user who all are connected in this hub belongs to different locales, I have exact information of each users' locale. But while sending notification or messages how can I send the messages in their respective locales.

C# 4.0 Getting NullReferenceException IRepository.Insert Call DNN Evoq 8.2

I'm working on a custom module for our site. The process flow is as follows. Customer hits a specific page Page detects if customer is authenticated No - forces login/register Yes - Continues Verifies customer data Retrieves token and ttl from sister site Stores data in db table Redirects customer to sister site using token to login I have the following class: [TableName("AutoRegister_Data")] [PrimaryKey("rId", AutoIncrement = true)] [Scope("ModuleId")] [Cacheable("AutoRegister_Data", Ca

C# 4.0 Deserializing with a json file with inner classes with JSON.NET C#

I have the following structure in my json file "missionName": "missionname", "thumb_image": "pics/mission-info.png", "uplinkPage": [ { "RPC": { "name": "RPC", "rpc": "", "args": "" }, "EXE": { "name": "app1", "prog": "", "args": "" }, "VM": { "name": "VM", "name": "", "args": "" }, "JAR": { "name": "JAR",

C# 4.0 iText7 for .NET - error while merging files

I've created simple method that allows me to merge multiple PDF files. Below is my code: private void Merge(List<string> src, string dest) { Stopwatch sw = new Stopwatch(); sw.Start(); PdfDocument pdfDocument1 = new PdfDocument(new PdfReader(src[0]), new PdfWriter(dest)); for (int i = 1,max=src.Count; i < max; i++) { PdfDocument pdfDocument2 = new PdfDocument(new PdfReader(src[i])); var pagesCount = pdfDocument2.GetNumberOfPages(); pdfDocume

C# 4.0 Html content in mail body is getting empty in out look mail client after switching to MS Exchange

We are generating a .msg file using following code mailMessage.HtmlBody = strBody;// Here we have html content var filename = Server.MapPath(Request.ApplicationPath + "/documents/email.msg"); MapiMessage outlookMsg = MapiMessage.FromMailMessage(mailMessage); outlookMsg.Save(filename); After saving .msg file we are manually opening it using outlook mail client. It opens fine with all html content in the mail body. But on sending the mail to recipient, the mail body doesn't have the html conten

C# 4.0 Get TFS ServerVersion using TfsTeamProjectCollection

I'm using TfsTeamProjectCollection to get the list of collection in the TFS Uri but I need to know the requested Uri is TFS2013 or TFS2015; I have used the below code to find the BuildServerVersion var tfsServerVersion = collection.GetService<IBuildServer>().BuildServerVersion; I can see V1, V2, V3, V4, V5 but how do I know which version they are(I mean TFS2013 or TFS2015). and there is no supportive reference for enum BuildServerVersion @ MSDN too Suggest me how to find the TFS serv

C# 4.0 I have 5 forms and I want to know how to return to the main form after closing 5th form

I have two questions: 1- I have a project that contains 5 forms, So I want to know how to return to the first form when closing the 5th form. 2- I have two buttons, one is visible on the form and the second one is not. What I wanted to do is to display the second button when the first button is clicked. I added this code on the Form_load event: btn2.Visible= false, and I added this code under btn1_Click: btn2_Visible=true, but it didn't work. Can anyone help me please? Form4 newform = new Form

C# 4.0 throw System.StackOverflowException while creating object

when i run my code in console i find this massage: Process is terminating due to StackOverflowException. public class MyDictionary< TKey, Tvalue> : Dictionary<TKey,Tvalue> { private MyDictionary<TKey, Tvalue> md; public MyDictionary(int size) {md = new MyDictionary<TKey, Tvalue>(size);}} static void Main(string[] args) {var sOn = new MyDictionary<int, string>(4);} when i use debug mode i find the problem in the constructor but i don't know what is the problem?

C# 4.0 Postsharp Include all methods except constructors

If I have an MethodInterceptionAspect how can I define it to include all methods in the class it is intercepting except for the constructors? For example something along the following lines appears not to work... [MyAspect(AttributeTargetMembers="regex:!.cctor|.*")]

C# 4.0 Return a set of objects from a class

I have a method that adds a new item to an EF table, then queries back the table to return a subset of the table. It needs to return to the caller a set of "rows", each of which is a set of columns. I'm not sure how to do this. I have some code, but I think it's wrong. I don't want to return ONE row, I want to return zero or more rows. I'm not sure what DataType to use... [qryCurrentTSApproval is an EF object, referring to a small view in SS. tblTimesheetEventlog is also an EF object, referring

C# 4.0 dynamically set the propeties in c#

i have the following code in c# class1 { public string Body { set { byte[] bytesToEncode = Encoding.UTF8.GetBytes(value); string encodedText = Convert.ToBase64String(bytesToEncode); this._body = HttpUtility.UrlEncode(encodedText); } } } now inside some another class i have to provide the string values to Body like class my class { class1 c = null; c.body = ??? } Please help me out how to give the valu

C# 4.0 Image getting zoomed and cut off when converting from binary data

I have some background images stored as binary data. I need to draw something on it based on data and then show it as a single image in the browser. The issue is that some of the images are getting zoomed in and some get zoomed out when I try to do this with the following code. Can anyone please tell where I am going wrong? int imageWidth = 0, imageHeight=0; Image bmpImg; if (datatable.Rows.Count > 0) { bmpImg = Bitmap.FromStream(new MemoryStream((byte[])datatable.Rows[0]["data"]));

  1    2   3   4   5   6  ... 下一页 最后一页 共 21 页