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

[ad_1] 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 [ad_2] solved How to give mutiple spaces to … Read more

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

[ad_1] 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 … Read more

[Solved] Numbers only password strength [closed]

[ad_1] 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 [ad_2] solved … Read more

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

[ad_1] 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, … Read more

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

[ad_1] 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 … 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]

[ad_1] 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 [ad_2] … Read more

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

[ad_1] 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 … Read more

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

[ad_1] 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; … Read more

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

[ad_1] 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?>; … Read more

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

[ad_1] 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 [ad_2] solved Can not pass error via … Read more