[Solved] Error Message is not clear to me

If what you posted is your whole class, you’re missing a curly brace. Exactly as the error message says. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class Default2 : System.Web.UI.Page { protected void gettickvalue(object sender, EventArgs e) { Random RandomNumber = new Random(); int n = RandomNumber.Next(1, 9); … Read more

[Solved] how i make listbox and choose the items from it? [closed]

You should use either string captcha = listBox1.SelectedItem.ToString(); Or int captchaIndex = listBox1.SelectedIndex; In the code you posted, captcha contains a string representation of the listBox1.SelectedIndex instead of the item’s text. 0 solved how i make listbox and choose the items from it? [closed]

[Solved] Can you pass arguments to many constructor methods in C#? [closed]

If I got your question right, you’re looking for something like Constructor-Chaining public class Class1 { public Class1() : this(string.Empty) { } public Class1(string val1) : this(val1, string.Empty) { } public Class1(string val1, string val2) :this(val1, val2, string.Empty) { } public Class1(string val1, string val2, string val3) { // Do something with the val’s } … Read more

[Solved] How to pass method name as a parmeter? [closed]

Refactor the code that is repeated into a method that takes an Action<int[]> parameter. Something like this (untested): void Main() { Random rnd = new Random(Guid.NewGuid().GetHashCode()); int[] ArrayRandom = new int[200000]; for (int j = 0; j < ArrayRandom.Length; j++) ArrayRandom[j] = rnd.Next(int.MaxValue); performSort(“Heap Sort”, ArrayRandom, HeapSort); performSort(“Cocktail Sort”, ArrayRandom, HeapSort); performSort(“Selection Sort”, ArrayRandom, HeapSort); … Read more

[Solved] C++field of struct if error

restavracija is a type, not an object. You have to instantiate it to produce an object. In this particular case, it looks like you’re expecting an array of them, and you want to call that array polje. Such an array declaration will look something like: restavracija polje[10]; Accessing element i in that array will then … Read more

[Solved] different ways of declaring main function c# [closed]

I think the better question is, What does each part of the typical Main method declaration mean? Can you take out some keywords? Sure, but the method will not necessarily be the same as the one defined below. public static void Main(string[] args) public refers to the visibility, without public, the code will use its … Read more

[Solved] Why does this causes the application to hang [closed]

The biggest problem here is that your constructor does not return until all of the tasks have completed. Until the constructor returns, the window will not be shown, because the window messages related to drawing the window aren’t going to be processed. Note that you don’t really have “deadlock” here per se. Instead, if you … Read more

[Solved] please clear – To achieve runtime polymorphism in c# we use Interface? [closed]

You don’t have to define seperate interfaces for this. You can also use a baseclass to achieve polymorphism. For more info check this page: Polymorphism – C# programming Example of using polymorphism in C#: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Animals { class Program { static void Main(string[] args) { … Read more

[Solved] String to String[] [closed]

To convert a string to string[], you can initialize a single-element array: efStudent.sponsor = new string[] { Convert.ToString(student.Sponsor) }; 4 solved String to String[] [closed]

[Solved] Reading and writing a file in byte array in C/C++

Make sure you’re checking the actual size. Windows has different ways of showing it. Compare the “Size” in bytes (e.g.16666) rather than the “size on disk”, which will be rounded up depending on the filesystem. Update Your drop box link has this code like this:- FILE* output = fopen( “test_output.dat”, “wb” ); fwrite( fileBuf, 1, … Read more

[Solved] Convert c++ vector to c-style pointer

Look here vector<vector<double> >a(3,vector<double>(4)); You defined a as a vector having 3 elements of type vector<double>. So a[0] has type vector<double>. vector is a user defined type. It is not a pointer. 2 solved Convert c++ vector to c-style pointer

[Solved] What are the Min and Max variable names length from one million variable names in C++? [closed]

The first character in an identifier must be a-z, A-Z, or underscore, for 53 possibilities. Subsequent characters can be digits 0-9 too, for 63 possibilities. So n characters give 53 * (63**(n-1)) legal identifiers: Length Names 1 53 2 3339 3 210357 // much less than 1000000 4 13252491 // much more than 1000000 Some … Read more