[Solved] Smtp authentification required [duplicate]

You need to tell the SMTP client that you will not be using your windows credentials to access the SMTP, so add smtpClient.UseDefaultCredentials = false; above this line of code smtpClient.Credentials = new NetworkCredential(“[email protected]”, “password”); Also, gmail doesn’t allow impersonation, so mailMessage.From = new MailAddress(“[email protected]”); will have no effect – the emails will still appear … Read more

[Solved] Operator ‘+’ can’t be applied to operands of types ‘decimal’ and ‘double’ – NCalc [closed]

Ok. I looked at the source code. And here is what I found. The Abs(-1) part of the expression is always evaluated as a decimal Result = Math.Abs(Convert.ToDecimal( Evaluate(function.Expressions[0])) ); Cos(2) is evaluated as double Result = Math.Cos(Convert.ToDouble(Evaluate(function.Expressions[0]))); And C# does not allow you to add these two types together. The reason that Math.Abs(-1) + … Read more

[Solved] C#, Winform: How to pass information from one form to another [duplicate]

You have to find the form and call the method, e.g. using System.Linq; … Application.OpenForms .OfType<Form1>() // Among the all opened forms of Form1 type .LastOrDefault() // Take the last one (or null if there’s no such form) ?.AfterConnect(); // And call AfterConnect() on it (if the form has been found) 2 solved C#, Winform: … Read more

[Solved] How do I close the client connection in a uhttpsharp request handler? [closed]

I ended up figuring it out. Since I think it may be useful to others I put it here. Due to how the request handling is implemented the library expects a completed task (available with Task.Factory.GetCompleted) in order to properly close the connection with the client. Dim hs As New uhttpsharp.HttpServer(New uhttpsharp.RequestProviders.HttpRequestProvider()) hs.Use(New uhttpsharp.Listeners.TcpListenerAdapter(New System.Net.Sockets.TcpListener(Net.IPAddress.Any, … Read more

[Solved] How do I run this code

That code won´t run without visual studio since it have code that must be run on the server. The only thing you can do is copy the code between HTML tag and save it to an HTML file. That will run but since you have logic on your server side your upper case wont work. … Read more

[Solved] set response encoding from XML

Try setting the encoding to the encoding from the code page 1252. The example below uses a simple service to serve the file, and setting the encoding to UTF-8 shows the same problem you have; setting it to the correct encoding works. public class StackOverflow_7044842 { const string xml = @”<ajax-response> <response> <item> <number></number> <xxx>Não … Read more

[Solved] Merging Lines of text where string ends in a specific condition

Here is a working solution that was developed for (var i = 0; i < Lines.Length; i++) { Builder.Append(Lines[i]); if (Lines[i].EndsWith(” and”) || Lines[i].EndsWith(” of”) || Lines[i].EndsWith(” for”) || Lines[i].EndsWith(” at”) || Lines[i].EndsWith(” the”)) { if (i < (Lines.Length – 1)) { Builder.Append(” “).Append(Lines[i + 1]); i++; } } Builder.AppendLine(“”); } return Builder.ToString(); solved Merging … Read more

[Solved] Compare two strings to a value in C# [closed]

I’d advise against using == to test string equality. Use String.Equals() instead. You can also do this in one statement using Linq: if ((new [] {string1, string2, …}).Any(s=>string.equals(s,”No”,StringComparison.CurrentCultureIgnoreCase))) { DoStuff(); } This will DoStuff() if any of your strings are equal to “no” ignoring the case. See String.Equals() and Enumerable.Any() for further reading. It should … Read more

[Solved] Get a list of all excel processes started by winform application

Okay I have found the answer myself. I am sharing it just in case someone needs it. int myappid = Process.GetCurrentProcess().Id; Process[] processes = Process.GetProcessesByName(“EXCEL”); foreach (Process prs in processes) { var query = string.Format(“SELECT ParentProcessId FROM Win32_Process WHERE ProcessId = {0}”, prs.Id); var search = new ManagementObjectSearcher(“root\\CIMV2”, query); var results = search.Get().GetEnumerator(); results.MoveNext(); var … Read more

[Solved] System.Reflection.Emit::DynamicMethod: Is there a tool to have IL code generated from existing assembly?

Your question is pretty vague, so I can give you only a vague answer: try Mono Cecil. It allows you to inspect IL in an existing assembly and modify it, which sounds close to what you’re asking. 1 solved System.Reflection.Emit::DynamicMethod: Is there a tool to have IL code generated from existing assembly?