[Solved] How to reuse a form ( and change its context when needed) to avoid multiple identical forms? C# [closed]

Why do you need a new form class for each country? The idea of a class is that it holds common behaviours. A form is a class. just instantiate an instance of the class with the data that it needs to display. Create a data class to encapsulate the data that the form shows (like … Read more

[Solved] Streamreader Directory [closed]

When you run a web application, the current working directory of the process isn’t the directory containing your source code. You might want to look at HttpServerUtility.MapPath or HostingEnvironment.MapPath. Note that this doesn’t really have anything to do with StreamReader – for diagnostic purposes, you’d be better off with something like: FileInfo file = new … Read more

[Solved] segmentation fault for vector iterator

In this declaration: vector<int>::iterator rit_i,rit_j,initial = vec.end(); only initial is initialized with vec.end(). To make it do what I think you expect, you have to write vector<int>::iterator rit_i = vec.end(), rit_j = vec.end(), initial = vec.end(); or vector<int>::iterator rit_i,rit_j,initial; rit_i = rit_j = initial = vec.end(); or something to that effect. solved segmentation fault for … Read more

[Solved] difference between format strings

Replaces the “#” symbol with the corresponding digit if one is present; otherwise, no digit appears in the result string. Note that no digit appears in the result string if the corresponding digit in the input string is a non-significant 0. For example, 0003 (“####”) -> 3. Source So in your case you have a … Read more

[Solved] Trying to show a Windows Form using a DLL that is imported at the runtime in a console application

The problem is that Activator.CreateInstance does not return ExpandObject (dynamic). You should run test() by reflection, like this : foreach (Type type in DLL.GetExportedTypes()) { dynamic c = Activator.CreateInstance(type); MethodInfo methodInfo = type.GetMethod(“test”); methodInfo.Invoke(c , null); } 2 solved Trying to show a Windows Form using a DLL that is imported at the runtime in … Read more

[Solved] how to remove a substring of unknown length from a string – C++ [closed]

Use rfind to get the location of the last slash then substr to return the right side of the string. Since substr‘s second argument defaults to “the end of the string” you only need to provide the beginning position: #include <string> std::string GetURLFilePath(const std::string& url) { auto last_slash_location = url.rfind(“https://stackoverflow.com/”); if(last_slash_location == std::string::npos || last_slash_location … Read more

[Solved] Extension method for List Contains(T? object) how to? [closed]

From your comments on the other answer, it looks like you’re trying to do something like var myWantedIds = new List<int> { 1, 2, 3 }; var matchingItems = myEntityFrameworkItems .Where(efItem => myWantedIds.Contains(efItem.NullableIdProperty)); Writing an overload of Contains won’t help here, as it can’t be translated into SQL. One thing to try is to check … Read more

[Solved] c search for target string in string [closed]

Looking at the error messages is sufficient to debug the code and make it work. It’s very basic error messages that can be resolved just by reading the code once. 1) extern.c:14:7:conflicting types for ‘array’ char *array[5][0]; ^~~~~ extern.c:6:6: note: previous declaration of ‘array’ was here char array[5][10]; Error: There is declaration of same variable … Read more

[Solved] Print ABC – string [closed]

Can you try something like following? I haven’t tested the following but it should work on most part. // Elvis’s hip and happening ABC-printing code #include <stdio.h> #include <string.h> #define NUM_ABC_LET 26 void makeABC(char abc[NUM_ABC_LET]); int main() { char abcString[NUM_ABC_LET + 1]; makeABC(abcString); puts(abcString); return 0; } void makeABC(char abc[NUM_ABC_LET + 1]) { char letter; … Read more