[Solved] Still Learning ‘System.StackOverflowException’ was thrown.’

The problem is in TeamLeader::getData() getTBonus() is calling getTPay() which is calling getTBonus() again causing an infinite loop, which will throw the StackOverflowException. You might try using if…else if in those methods instead of just if. public decimal getTBonus() { decimal tBonus = 0; if (TrainHours <= 0 && Hours <= 0) { tBonus = … Read more

[Solved] Running Program from USB drive [closed]

You can get the executing assembly path. string path = (new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath; From there, you can obtain the drive letter (path root): string drive = Path.GetPathRoot(path); If your file is in the same directory as the executable, you can get the file path like this: string directory = Path.GetDirectoryName((new System.Uri(Assembly.GetExecutingAssembly().CodeBase)).AbsolutePath); string databaseFile = Path.Combine(directory, “filename.dbf”); … Read more

[Solved] ASP.NET C# help me about sum or minus in amount

Try this: var total = dataGridView1.Rows.Cast<DataGridViewRow>() .AsEnumerable() .Sum(x => x.Cells[3].Value.ToString() == “Credit”? int.Parse(x.Cells[2].Value.ToString()) : -(int.Parse(x.Cells[2].Value.ToString()))) .ToString(); textBox1.Text = total; 3 solved ASP.NET C# help me about sum or minus in amount

[Solved] Try to answer some boolean queries using Term-Document-Incidence-Matrix [closed]

Your problem is in this line: (ProcessFiles function) String[] termsCollection = RemoveStopsWords(file.ToUpper().Split(‘ ‘)); you’re splitting the name of the file and not its content That’s why you have no search results you should do something like this instead: String[] termsCollection = RemoveStopsWords(File.ReadAllText(file).ToUpper().Split(‘ ‘)); Now change your TermDocMatrix constructor: public TermDocMatrix(string IndexPath,string FileName) { if (!Directory.Exists(IndexPath)) … Read more

[Solved] How to make global variables? [closed]

Create singleton class so that instace can be created once and used across application public class Global { private static readonly Global instance = new Global(); public static Global Instance { get { return instance; } } Global() { } public string myproperty { get;set; } } Usage: Global.Instance.myproperty solved How to make global variables? … Read more

[Solved] get tree structure of a directory with its subfolders and files using C#.net in windows application [closed]

Method 1 HierarchicalItem holds the information we need about an item in the folder. An item can be a folder or file. class HierarchicalItem { public string Name; public int Deepth; public HierarchicalItem(string name, int deepth) { this.Name = name; this.Deepth = deepth; } } SearchDirectory is the recursive function to convert and flatten the … Read more

[Solved] TextBox not containing “\r\n” strings

As I said in the comment, with Multiline=True and WordWrap=True, your textbox will display a long line as multilines (Wrapped)… but actually it is one single line, and that’s why your Lines.Length=1, try type in some line break yourself, and test it again. Or you can set WordWrap=False, and you will see there is only … Read more

[Solved] How to insert a string into an sql server table via a windows form? [closed]

AddTof1(string s) { using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); using (SqlCommand command = new SqlCommand(“INSERT INTO table1 values(@s)”, connection)) { command.Parameters.AddWithValue(“@s”, s); command.ExecuteNonQuery(); } } } Then you can call this method as; AddTof1(“hello there”); 4 solved How to insert a string into an sql server table via a windows form? [closed]

[Solved] Drawing a rectangle with a certain angle of degree

It depends on the drawing environment you’re using. For example, if you use HTML5 canvas, you could rotate the canvas, draw the rectangle and then return the canvas to the original position, obtaining the “rotated” rectangle. You should check your environment documentation for further info or give more info in the question so we can … Read more

[Solved] Checking if all textboxes in a panel a filled

Perhaps something like this: foreach(Panel pnl in Controls.OfType<Panel>()) { foreach(TextBox tb in pnl.Controls.OfType<TextBox>()) { if(string.IsNullOrEmpty(tb.Text.Trim())) { MessageBox.Show(“Text box can’t be empty”); } } } 0 solved Checking if all textboxes in a panel a filled

[Solved] C# If i click button2 (in form2) , label1 show in form 1 [closed]

Add this code to Form1’s button click, private void button1_Click(object sender, EventArgs e) { Form2 from2 = new Form2(); Control[] button = from2.Controls.Find(“button1”, true); button[0].Click += new EventHandler(ShowLabel); from2.ShowDialog(); } Add this Form1 too (Set the WORK label’s visible property to false under properties) private void ShowLabel(object sender, EventArgs e) { label1.Visible = true; //Setting … Read more

[Solved] create a wizard [closed]

It looks as if you will need to create a UserControl (right-click your project, New… User Control) for each page of the Wizard, and you will need to implement IWizardPage on your UserControl. Than you have your WizardHost which is a single Form. So to answer your question you will have one Form and a … Read more