1,857 Posted Topics
Re: One way is to store the number of the current question in the Tag property of the button. Then you can put it, cast to an integer, in a variable and use that instead of a literal number. Then increment it and replace the Tag value with that. button1.Tag = … | |
Re: Actually AllocSysString() returns a BSTR but it's a member of CString. Change the wchar_t to Cstring: Cstring str; return str.AllocSysString(); | |
Re: For more flexibility, I would suggest WPF. There's a bit of a learning curve, but it allows you to have more options in transparency and animation. | |
Re: Assuming that `tempdoc` is a string that represents a number and that the record loaded is always the most recent version, one way to do this would be to cast the string as an integer, increment it then cast it back to a string. The `Convert` class would work well … | |
Re: `Console.WriteLine(ex.Message)` doesn't do anything in a form project, you should use MessageBox.Show(ex.Message, "Database Error", MessageBoxButtons.OK, MessageBoxIcon.Error) instead. Also, since anyone else using this code isn't necessarily going to use the same query, it would make sense to pass, the query, the connection string and even the DataGridView, to allow using … | |
Re: A helper function to choose the list will help cut down on duplicated code: LIST_NODE* ChooseList(ROOT_NODE * root, int data) { switch (data % 3) { case 0: return root->first; case 1: return root->middle; case 2: return root->last; default: printf("Invalid index"); break; } } Now to each function you pass … | |
Re: Firstly, your struct needs some work. Since long-hand addition starts from the right not the left, it would make sense to keep track of where the right most digit is in the array. To accomplish this an additional field(size) will come in handy. Another thing to keep in mind, if … | |
Re: Firstly I would suggest a couple of helper functions: void PrintHeader() { printf("Producer\tModel\tChassis Number\n"); } void PrintVehicle(VEHICLE* ve) { printf("s%\ts%\ts%\n", ve->prod, ve->mod, ve->chs); } Now it's a matter of iterating through the tree and printing any vehicle matching that producer. Something like this should work: void FindVehicles(NODE* root, int field, … | |
Re: It looks to me the problem is you're adding the burst time to the waiting time on the first iteration. You probably need to save the previous burst time then add it to the wait time. Something like this: int pbt = 0; for (j = 0; j < n; … | |
Re: Using a string as the collection holding the digits will automatically reallocate memory and make the display() function much simpler, while providing you with an indexed collection that you can iterate through. | |
Re: 2 things to start with: * In the Expenditures class your functions are using a variable(sp) that isn't defined anywhere in the functions or the class. * You use this statement alot: `else {cerr<<"Wrong Choice!!"; exit(0)};`. The semi-colon goes inside the bracket: else { cerr<<"Wrong Choice!!"; exit(0); } Notice how … | |
Re: Basically, remove the Address operators in line 140: print(arr+i,n,psurname,pname); | |
Re: I think you may be overthinking this a bit. A 5X5 array contains a 4X4 array in it, just use indexes 0-3. Leave the index 4 for the min and max values. Now everything, entering the data, finding the min values, and finding the max values, can be done in … | |
Re: One of the simplest ways to get the index of test is to use a counter: int index = 0; for ( int idx = 0; idx < N; idx++ ) { for ( int k = idx + 1; k < N; k ++ ) { if ( array[ … | |
Re: First off that's not complete code. You should submit the whole code. Secondly what doesn't work? What is it doing right? What is it doing wrong? | |
Re: Also with VS2015 the realtime syntax suggestion/checking(Intellisense) for c++ is quite good. Once you get used to it it's hard to go back. | |
Re: What you need to do is handle the click event of the button, then check the current text of the button and act accordingly. To create the handler template, one of the easiest ways is to double-click the button and VS will automatically create the template, ready for you to … | |
Re: What you neded to do is use the `new` operator: DirectoryInfo dir = new DirectoryInfo(comboBox2.SelectedItem.ToString()); Just remember that the DirectoryInfo constructor requires the full path of the directory. The Path.Combine() method works well in combining the different parts of a path into one string. On a side note, the 2 … | |
Re: Assuming that the text file will never be a super huge file, you can read the whole file into memory and do multiple searches without reading the file each time. | |
Re: Also only put one problem in a post. This way each can get the attention it deserves and also helps other people with the same problem find a solution. | |
Re: Your question indicates you've tried things that don't work. To avoid duplicating this work, you should show the code you've tried and how it doesn't work. Also this [blog](http://www.sparxeng.com/blog/software/must-use-net-system-io-ports-serialport) discusses serial port communication in .net | |
Re: One problem could be here `If Not IsDBNull(e.Value) Then` try checking for Nothing instead of DBNull `If e.Value IsNot Nothing Then` | |
Re: One of your problems is here: scanf("%c%lf", &operation, &number2); Separate this into 2 scanf's and only do the second one if a r or R wasn't entered. Something like this: scanf("%c", &operation); if(operation != 'r' && operation != 'R') { scanf("%f", &number2); ... and so on On a side note … | |
Re: You might be better off using a .net wrapper for the libcurl library, of which google shows there are several, rather than trying to run a separate process. | |
Re: In looking at your code, it appears to me, that if p is NULL then there are no members and an error will result. I'm thinking that in the while statement, checking if `size != 0` would work better. On a side note having different nodes in the tree with … | |
Re: One way would be to handle the SelectedIndexChanged event of the second combobox. Inside the handler that you create, you can read the SelectedIndex property of each combobox to calculate the distance between stations. | |
Re: First off in order to have Computer the base class for Laptop you need to declare it as such: class Laptop : Computer The problem you have now is naming the Laptop show function the same as the Computer show function. The compiler can't see past the Laptop show function. … | |
![]() | Re: A couple of areas don't follow the flowchart: if (workNum % 2 == 0); { workNum += 1; } This checks if the number is even not odd. Try `if(workNum % 2 == 1)` sum = num1 + num2; Here you keep adding num1 to num2, but you want to … ![]() |
Re: In here: x = p.x; y = p.y; The Point properties are `X` and `Y`, not `x` and `y`. In here: private Point FindClosest() { for (int x = LastMove.x - 1; x < x +1; x++) { if (x < 0 || x >= Board_Size) { continue; } if … | |
Re: It appears to me one of your problems is here: BOOL in_hand[NUM_SUITS],[NUM_RANKS] = {FALSE}; When you're declaring a multidimensional array there isn't supposed to be a comma separating the dimensions. Due to the nature of compiling c source code, this error right near the start could be creating the other … | |
Re: It's pretty hard to say where the problem could be without seeing the code in question. | |
Re: Just on the surface, it looks like `SearchBySurname` is expecting `TreeNode<T>` type but `ProcessMenu` is trying to pass `AVLType<T>` | |
Re: I don't see anything that could cause the problem you describe. I'm wondering though if `CumLoss` is represented as a positive integer and then added to `CumProfit`, could that be skewing your results to give the effect you observe? If not, you'll most likely have to submit enough of the … | |
Re: This function: bool operator ()(CSalary& obj) { m_ResSqrt += obj.GetSalary()*obj.GetSalary(); m_Res += obj.GetSalary(); } Doesn't appear to be complete. It doesn't use the parameter and there's no return statement | |
![]() | Re: Basically inside the block for each package, check if the new checkbox is checked then see if the Hours is enough to warrant a savings in the other packages. For instance in package A if the Hours is 25 it would cost 39.95 but package B would only cost 19.95, … |
![]() | Re: Here's a pretty good Article on how a [Double Transposition Cipher](http://www.pbs.org/wgbh/nova/decoding/doubtrans.html) works. The first thing you'll notice is that it requires 2 keys not just one. ![]() |
Re: Your description is a bit vague. What would a sample of the starting data look like? What would a sample of the finished data to look like? What code are you using to reorginize the data? | |
Re: One thing I noticed the `DeleteItem` function in the `TreeType` class is expecting a `ItemType` object but you're trying to pass an int. | |
Re: The inputData function has no return type(it probably should be void, since the prototype is). Also the constructor is not a member of `this`. Rather than trying to call the constructor you should probably have that code in a private function and call that instead. | |
Re: Just from a quick glance I would suspect that the trailing `;` in the connection string is causing OleDbConnection to look for another value which isn't being supplied. I would suggest deleting that: Dim AccessConn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=p:\inquiries.mdb") | |
Re: The Cells collection is a property of the Row class which is indexed in the Rows property of the DGV. You have to identify which row and which cell to insert the data. | |
Re: Alternatively reading the next line into a temporary variable will allow you to weed out any blank lines and only keep the last populated line: Using sr As New StreamReader(File.OpenRead("D:\test")) Dim LastLine As String, I, J As Integer, P As Long Do I = 0 J += 128 P = … | |
Re: When you create your function try to use meaningful names for your variables. Imagine trying to decipher what they mean 2 or 3 years in the future. | |
Re: Right after you assign the variables inside the loop, check if firstLetter is upper case. If it is make it lower case and make the first character in restOfWord upper case. | |
Re: Have you tried using one timer? With the interval set to the timer1 interval, you can use the modulus operator(modulo the interval) to fire the first window when it is 0 and fire the second window when it is 100. With an interval set to 1000 the timer will fire … | |
Re: You're taking the selected index converting it to a string then trying to store it as an integer. C# doesn't allow this kind of implicit conversion. What you probably need to do is just store the selected index directly: int inx = ImageList.SelectedIndex; | |
Re: I don't have much experience with Eclipse, but I've seen somne IDE's that don't pause the console after main is finished. On a small app like this, it will look like it didn't run at all. Basically though it has run and finished just too fast for you to see … | |
Re: Here's a pretty good [article](http://www.cplusplus.com/forum/articles/17108/) that discusses that | |
Re: You seem to be copying a lot of your data. Plus you have no code for `Combinations` and `Line`, which may do more copying, but without the code it's hard to say for sure. Just from a quick glance allNumbers is only used to pass to Combinations, passing the Keys … | |
Re: This would also be a good time to learn about classes and object oriented programming. These will not only streamline your code for this project but will be of great help to any future projects. In fact you will probably be better off forgetting most of what you learned using … |
The End.