Tag c#-4.0

[Solved] why instance variable returns null in c#? [closed]

So, where you call GetSingleLocationInfo, you are calling an async method. GetSingleLocationInfo calwill therefore run as far as the await statement then return stright to the caller, before the it httpClient.GetStringAsync(hereNetUrl); has returned. To fix this, you need to await…

[Solved] sort in Ascending Order [closed]

Did little example to understand object parsing into int type parameter. List<object> _obj = new List<object>() { “10”, “20”, “30”, “d”, “a”, “t” }; int sum = 0; for (int i = 0; i < _obj.Count; i++) { int temp;…

[Solved] Show String Data in Message Box C#

Try this: MessageBox.Show(String.Format(“{0}, {1}, {2}:”, city, zip, state)); This go replace {0} with the variable city, {1}with the variable zip and {3} with state. String.Format converts the value of objects to strings based on the formats specified and inserts them…

[Solved] How to call a service from console Application in c#

HttpWebRequest req = null; HttpWebResponse resp = null; string baseaddress = “http://deveqtradedb.lazard.com/API.aspx?action=export&entity=global”; req = (HttpWebRequest)WebRequest.Create(baseaddress); req.Method = “POST”; req.ContentType = “text/xml; encoding = UTF-8”; resp = req.GetResponse() as HttpWebResponse; Check Here (v=vs.110).aspx solved How to call a service from console…

[Solved] How to Remove number from Extension with string?

You can use regex as shown or a simple LINQ query, i’d also recommend System.IO.Path: string originalPath = “Url1234.pdf”; string dir = Path.GetDirectoryName(originalPath); // in this case “” string extension = Path.GetExtension(originalPath); // .pdf string fn = Path.GetFileNameWithoutExtension(originalPath); // Url1234…

[Solved] Datatable to dictionary [closed]

Based on the additional information, the problem is that you are not passing the right arguments to ToDictionary. It takes two lambdas, not a lambda and a List<>. Here’s the first step to fixed code: dt.AsEnumerable().ToDictionary( dtRow => dtRow.Field<Int64>(“CodeVal_1”), dtRow…

[Solved] auto click in C# in difrent position of screen [closed]

in WPF you can use this line of code to set mouse position [System.Runtime.InteropServices.DllImport(“user32.dll”)] static extern bool SetCursorPos(int x, int y); this line to firing the event [System.Runtime.InteropServices.DllImport(“user32.dll”)] static extern void mouse_event(int dwFlags, int dx, int dy, int dwData, int…