[Solved] How to give mutiple spaces to an integer to shown on form as a string in c#? [closed]

You can convert your number to a string, split into characters and join these again with spaces: int i = 690110; char[] chars = i.ToString().ToCharArray(); // To get a formatted string: string s = string.Join(” “,chars); // To get the digits: int[] digits = chars.Select(x=>Convert.ToInt32(x)).ToArray(); 3 solved How to give mutiple spaces to an integer … Read more

[Solved] Cannot implicitly convert type ‘object’ to ‘int’. An explicit conversion error exists

The first error is because of this: Array myPort;. That’s not how you declare an array, Array is an abstract class that provides methods to operate on arrays. SerialPort.GetPortNames() returns a string array so you can either declare a string array or just remove the Array myPort; declaration and replace the other line with var … Read more

[Solved] Numbers only password strength [closed]

The regular expression is: ^((?!(?<ch>.)\k<ch>\k<ch>)(?!012|123|234|345|456|567|678|789|890)[0-9]){8,}$ The (?!(?<ch>.)\k<ch>\k<ch>) will check for the same character repeated thrice. Note that for the various contiguous sequences I had to put them in a list of possible sequences, (?!012|123|234|345|456|567|678|789|890). [0-9] is the character that will be accepted as valid. The {8,} is for the minimum length. 1 solved Numbers only … Read more

[Solved] Regex to extract only domain from sub-domains [duplicate]

Just to iterate on Jens’ comment, we have to guess: What is your expected output when additional information appears, e.g. http://therealzenstar.blogspot.fr/somedata.html. Is it still blogspot.fr? Are such examples needed to be adresed? You said you want to replace “everything else” with “”. Replace() will replace everything that is matched with what you want. So, to … Read more

[Solved] Why does MSDN documentation show protected methods for Random?

You seem to have several questions about the System.Random documentation. It lists three protected methods, but two of them are inherited from System.Object. The third one is Sample, which is documented to return “a random floating-point number between 0.0 and 1.0.” To answer your title question, no, the MSDN documentation is not incorrect. That method … Read more

[Solved] IF A BLANK SPACE IS PRESENT IN THE COLUMN HEADING …..AND/OR operator not working in sql statement in c# .net for modifying an excel sheet [closed]

I’m pretty sure that the problem is the space in the name of your Faculty Name column and that this has nothing to do with the use of AND or OR. Please try: sql = “Update [Sheet1$] set A1 = ‘a’ ” + “where Designation = ‘Prof(senior)’ and [Faculty Name] = ‘bob'”; 1 solved IF … Read more

[Solved] Now that part of the .NET Framework runs on Mac and Linux, how can we know if a .NET app will run outside of Windows?

If your app runs fine on .NET Core 5 in Windows (not full .NET Framework), then by definition it should run on .NET Core 5 on OS X and Linux. However that’s still too optimistic, as file paths and so on are still different enough to impact the way you write your code. Thorough testing … Read more

[Solved] Rearrange the autoincrement column value after deleting some rows

When you have declared the column as INTEGER PRIMARY KEY, you don’t need to do anything because the database automatically uses the next value after the largest value in the table. When you have declared the column as INTEGER PRIMARY KEY AUTOINCREMENT, the current counter is stored in the sqlite_sequence table. You can simply modify … Read more

[Solved] Using a public void from one form to another

You could make use of FormClosed/FormClosing event of the second form. When the second form closes, the event handler in the first form will be invoked and you could call the public method there. Example: public partial class FirstForm : Form { public void OpenSecondForm() { SecondForm form = new SecondForm(); form.FormClosed += SecondForm_FormClosed; form.Show(); … Read more

[Solved] Replace the same line if contains any word in it in c# [closed]

This is a fairly simple task: string url = @”http://google.com/adi/727412;sz=728×90;ord=$RANDOM?”; if (url.Contains(@”/adi/”)) { int pos = url.IndexOf(“;ord”); //// Find first occurence of Ord parameter url = url.Insert(pos, “;click=$CLICK”); //// Insert text at position } Edit: To accomplish the task for multiple occurences I used a solution from this thread. { string url = “<google.com/adi/727412;sz=728×90;ord=$RANDOM?>; <google.com/adi/727412;sz=300×250;ord=$RANDOM?>”; … Read more

[Solved] Can not pass error via delegate [closed]

Do same null-check as you did when invoked action first time: catch (Exception ex) { if (onError != null) onError(ex); return; } If you want to avoid null-checks – attach dummy handler to Action delegate at the top of your method: onError += (e) => {}; 2 solved Can not pass error via delegate [closed]