[Solved] Passing parameters from form 1 to form 2 [closed]

[ad_1] What’s stopping you from making it a parameter in the constructor? public Form2(bool foo) { } Then when instantiating the form: bool foo = false; Form2 MyForm = new Form2(foo); [ad_2] solved Passing parameters from form 1 to form 2 [closed]

[Solved] C# Constructor cannot call itself

[ad_1] You have a constructor that takes an IDbTransaction and a Action<UnitofWork> and starts by calling the constructor which takes an IDbTransaction and a Action<UnitofWork>, which is to say itself. That would then immediately call itself, then immediately call itself, then immediately call itself… If it was allowed, then one of two things would happen: … Read more

[Solved] parse a string to look for a phrase in C# [closed]

[ad_1] If it’s always going to be “NDC: [number]”, you can use a fairly simple Regular Expression. var re = new System.Text.RegularExpressions.Regex(@”NDC\:\s(\d{11})”); var phrase = “Rx: RX15046522B Brand: LEVOTHYROXINE SODIUM Generic: LEVOTHYROXINE SODIUM NDC: 00378180001 Barcode: 0378180001 Strength: 25 mcg Form: Tablet Color: orange Marking: Shape: oblong”; if (re.IsMatch(phrase)) { var match = re.Match(phrase); // … Read more

[Solved] The type namespace name Form1 could not be found

[ad_1] If the line you mentioned, System.Windows.Forms.Application.Run(new Form1()); is in a file in a different namespace to xpartygo, you’ll need to edit it to System.Windows.Forms.Application.Run(new xpartygo.Form1()); to sort the namespaces. Alternatively, place the file with the above line into the same namespace. In future, pasting the exact error message as output from the compiler, along … Read more

[Solved] Lambda expressions in c#

[ad_1] Try Select instead of Where to get a list of all can_main_key values: var candidate = db_can_records.CandidateMains.Select(m => m.can_main_key).ToList(); To get all the values for a single row of CandidateMains where you know the key try: var candidate = db_can_records.CandidateMains.FirstOrDefault(m => m.can_main_key == variableContainingRequiredId); [ad_2] solved Lambda expressions in c#

[Solved] Why does my is random access iterator have to be of type auto when i traverse a vector?

[ad_1] You don’t have to use auto if you don’t want to, but you can of course. The type returned by std::vector<int>::begin() and std::vector<int>::end() is a std:vector<int>::iterator (or std:vector<int>::const_iterator, depending on context), it is not an int. You could as well have written this instead: for(vector<int>::iterator it=vect1.begin(); it<vect1.end();it++){ cout<<*it<<endl; } or for(vector<int>::const_iterator it=vect1.begin(); it<vect1.end();it++){ cout<<*it<<endl; … Read more

[Solved] Replace xml node in c#

[ad_1] You mean something like this? XmlDocument xmlDoc = new XmlDocument(); XmlDocument xmlDoc2 = new XmlDocument(); xmlDoc.Load(xmlFile); xmlDoc2.Load(xmlFile2); XmlNode node = xmlDoc.SelectSingleNode(“Root/RuleDTO/RuleID”); XmlNode node2 = xmlDoc2.SelectSingleNode(“Root/RuleDTO[1]/RuleID”); XmlNode node3 = xmlDoc2.SelectSingleNode(“Root/RuleDTO[2]/RuleID”); if (node != null && node2 != null && node3 != null) node3.InnerText = node2.InnerText = node.InnerText; xmlDoc2.Save(xmlFile2); [ad_2] solved Replace xml node in c#

[Solved] If-else command in calculator [closed]

[ad_1] Use an else if statement like this one: if (angles.Count() == 2 && sides.Count == 1) { // calculate based on two angles and one side } else if (angles.Count == 1 && sides.Count == 2) { // calculate based on one angle and two sides } else { MessageBox.Show(…) } 1 [ad_2] solved … Read more

[Solved] What does the this pointer mean? [duplicate]

[ad_1] ‘this’ usually refers to the instance of the object that calls a particular method of a class,union,structure or a function. when you have same names for different variables, then ‘this’ is used to differentiate between them. class stu { int roll_no; string name; public: void input(int roll_no,string name) { name=this->name; roll_no=this->roll_no; } } stu … Read more