1,857 Posted Topics

Member Avatar for xcp3

Your code doesn't follow the description. You got 8 functions besides Main and none of them take any parameters, let alone any arrays. I would suggest using a class to represent a player. This allows you to have one function that accepts a player object and the board array as …

Member Avatar for AssertNull
0
313
Member Avatar for Nyron

array1 and array 2 are declared as int. This means that you are overwriting the values in them and the last loop is re-using the last value stored in them. Without a clear idea of the desired outcome it's hard to arrive at a solution.

Member Avatar for Nutster
0
238
Member Avatar for sashiksu

It looks to me that instead of adding 100000 you should probably use the value of I and add 100001 For Each row As DataGridViewRow In DataGridView1.Rows Dim obj(row.Cells.Count - 1) As Object For i = 0 To row.Cells.Count - 1 obj(i) = i + 100001 Next Me.DataGridView3.Rows.Add((obj)) Next This …

Member Avatar for Phoguez
0
302
Member Avatar for Abdelaziz_1

There are 2 main ways of doing this. Line by line conversion by hand Third party conversion tool. A search term such as `convert vb to c#` produces lots of hits in Google.

Member Avatar for rproffitt
0
386
Member Avatar for akshayg
Member Avatar for Christian Felix

In order top use an array effectively, you would need to make each pizza an object. This will require a custom class. Something like this: class Pizza { public: struct Item { string item = ""; int cost = 0; } Pizza(Item _size, Item _crust, Item _flavor, vector<Item> _extras); int …

Member Avatar for tinstaafl
0
174
Member Avatar for shantanu534

Your basic algorithm seems sound. Your problem with getting the correct answer could have something to do with how the site giving you the problem is expecting you to receive the data. A couple of things, though: The bounds checks are unnecessary, since the problem description guarantees the numbers will …

Member Avatar for tinstaafl
0
917
Member Avatar for AleMonteiro

Usually these types of errors mean you have to qualify which namespace the property/method belongs to.

Member Avatar for AleMonteiro
0
2K
Member Avatar for mpdph09

One way to do this is with the [Microsoft Magnificiation API](https://msdn.microsoft.com/en-us/library/windows/desktop/ms692402%28v=vs.85%29.aspx)

Member Avatar for mpdph09
0
471
Member Avatar for sungilcool

One of the problems with your existing code, is you're trying to access the pointers without allocating memory for them: template <class T> void matrixType<T>::initialize(T row1, T col1) { rawMatrix1 = new T*[row1]; for (int a = 0; a < row1; a++) { rawMatrix1[a] = new T[col1]; std::cout << "enter …

Member Avatar for tinstaafl
0
1K
Member Avatar for jemartalaban_1

If you're printing a registration form, you probably don't want any of the extra stuff, like the control box or any buttons, to be printed. Something like this might work: Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click 'make any controls you don't want printed invisible …

Member Avatar for tmccmt
0
8K
Member Avatar for abu taher

It looks to me that the query is loking to compare numbers but you're giving it a string. Try converting the subitem value to a number and calling the query with that.

Member Avatar for Santanu.Das
0
318
Member Avatar for mabdullah4

It looks to me that you need to read the file inside the while loop: while(infile.read(reinterpret_cast<char*>(&t1),sizeof(teacher))) { if(t1.getcnicno()!=check) { outfile.write(reinterpret_cast<char*>(&t1),sizeof(teacher)); } } Also checking for eof is not a reliable way of terminating the loop. Using the return value of read is more reliable.

Member Avatar for tinstaafl
0
281
Member Avatar for sashiksu

The class for the table is called DataTable. The columns are called DataColumns and the rows with data are DataRows. These classes are present by default in a vb.net form applcation. The basic steps to add data to the data table are: * Instantiate a new DataTable * Add the …

Member Avatar for tinstaafl
0
425
Member Avatar for Joseph_18

Somehow your original post got duplicated. My answer is in the other post. If your question is answered please remember to mark them solved. Thanks

Member Avatar for tinstaafl
0
309
Member Avatar for redtribal23

It looks to me that your problem is in the destructor for Toll Administrator. You're trying to delete arrays that haven't been allocated with the new operator. Since you seem to want to delete items from the arrays, making them dunamic, you might be better off using vectors instead, which …

Member Avatar for tinstaafl
0
211
Member Avatar for Ritzophia

It appears to me that one or more fields in one or more rows is empty, which is throwing the cast exception. Try using the `Is` operator instead of `=`: If dr(0) Is txtuname.Text AndAlso dr(1) Is txtpw.Text AndAlso dr(2) Is MetroComboBox1.Text Then On a side note, using `AndAlso` allows …

Member Avatar for tinstaafl
0
2K
Member Avatar for Joseph_18

It looks like you need to use the `AppendText` method of the TextBox class: foreach(string line in File.ReadAllLines(comboBox1.Text)) { textBox1.AppendText(line.Split(',')[0]+"\n"); }

Member Avatar for Joseph_18
0
288
Member Avatar for Eskindir_1

From an examination of your code, a part of your problem appears to be using `index` to fill the array, but your loop is incrementing `count`. Therefore the array is always using the same index. Also using `eof()` to terminate the loop is bad practise. Instead use the return value …

Member Avatar for tinstaafl
0
7K
Member Avatar for sashiksu

The classes involved are OpenFileDialog and SaveFileDialog. Basically instantiate a new instance of each class and use the `ShowDialog()` method to show it. The `Filename` property contains the filename opened, or saved.

Member Avatar for tinstaafl
0
429
Member Avatar for Prashanth K M

Actually you can do that all you need is a button(to signify when the typing is done) and a handler for its click event: Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click If ComboBox1.Text <> "" AndAlso Not ComboBox1.Items.Contains(ComboBox1.Text) Then ComboBox1.Items.Add(ComboBox1.Text) ComboBox1.ResetText() End If End Sub

Member Avatar for Santanu.Das
0
190
Member Avatar for ressenjack

It would help to know why you're using 2 decks. Part of your problem might be linked to duplicating your code in several places. If you pass the address of the deck to the displaydeck function you only need code to deal with the deck that's passed. Also this means …

Member Avatar for tinstaafl
0
1K
Member Avatar for usingnamespace

One way is to create a function,that returns a boolean, for each validation step. If each step is true the password is valid. This way you can concecntrate on each step and get it right before moving on.

Member Avatar for ravenous
0
253
Member Avatar for Arniel

There are great many option to accomplish this. One way, that doesn't require explicitly creating an extra array, is to use the Lines property of the RichTextBox, which is a string array already. The RichTextBox seems to like adding extra blank lines at the end, so before sorting, you'll need …

Member Avatar for tinstaafl
0
1K
Member Avatar for Bashy345
Member Avatar for chetan12

OK, you're getting there. You've got a description of your goal. You've got the code you've developed so far. Now we need a description of the problem(s) in your code that you have trouble fixing.

Member Avatar for tinstaafl
0
386
Member Avatar for tig2810

One way is to use a public method that uses the Add method of the List class: void AddOrderLine(OrderLine newOrderLine) { OrderLines.Add(newOrderLine) } I would suggest keeping the list private instead of public. This way you choose which methods the user can use to interact with the list and eliminates …

Member Avatar for tig2810
0
170
Member Avatar for Papa_Don

The application is in the folder you specified when you published it. The default folder is in the project folder. However, it is not an exe file. It is a .application file. The description should say ClickOnce Application. There should also be a shortcut in the Start Menu, with the …

Member Avatar for Minimalist
0
5K
Member Avatar for ztdep

One way would be with a custom class to represent the collection. Use a vector as the base collection, then overload the index operator to accept a negative value and offset it to find the correct positive value in the base collection. Here's what such a class might look like: …

Member Avatar for tinstaafl
0
250
Member Avatar for cool_intentions

If your xaml code has `State Triggers` the same as your post, remove the space, `StateTriggers`.

Member Avatar for cool_intentions
0
168
Member Avatar for James_55

It looks to me you might need some custom classes. One to represent the data for each record and also a class that controls a collection of that data: #include <iostream> #include <string> #include <vector> using std::string; using std::ostream; using std::istream; using std::vector; class DataCollection { private: class Data { …

Member Avatar for David W
0
247
Member Avatar for mpdph09
Member Avatar for tinstaafl
0
632
Member Avatar for toxicandy

It should be OK to use it the same as in the actual function block: int findMobile( string word, int dir[] );

Member Avatar for rubberman
0
272
Member Avatar for jeffrey4u

One option would be to just disable the controls on the MDIParent. First set the MDIParent property insted of the Owner property. Second add a static method to enable/disable the controls: public static void EnableControls(Form thisForm, bool enable = true) { if (thisForm.IsMdiContainer) { foreach (Control c in thisForm.Controls) { …

Member Avatar for jeffrey4u
0
2K
Member Avatar for Sonic1980

A couple things I've noticed: * You're loading the listboxes with the whole path. This makes finding the duplicates problematic at best. * You're duplicating the code to load the listboxes. A method taking the listbox as an argument will simplify this. Since you're loading file names and directory names, …

Member Avatar for tinstaafl
0
705
Member Avatar for Hamza_13

Try setting the value of the DateTimePicker by converting the cell value to a Date value dtpAppointmentdate.Value = Convert.ToDateTime(row.Cells["Appointment Date"].Value)

Member Avatar for JOSheaIV
0
391
Member Avatar for COKEDUDE

I would say, for while loops, that it depends on the trigger(s) needed to break out of the loop. If you need one of several triggers to break out of the loop then OR (||) would be needed. If you need several triggers to be set at the same time …

Member Avatar for David W
0
187
Member Avatar for සශික
Member Avatar for COKEDUDE

You're using post increment instead of pre increment. Which means the value of o changes after you assign c to it. Using pre increment o will increment then c will be assigned to it: *++o = c;

Member Avatar for tinstaafl
0
169
Member Avatar for COKEDUDE

Drop the second index. Because the value is NULL, which is the string terminator, basically you're asking to read the first character of a NULL string, which doesn't exist. printf("strings_line_tokens[]: %c %d \n",(char)strings_line_tokens[1], (int)strings_line_tokens[1]); As for detecting the NULL you can use 0 like you've done or you can make …

Member Avatar for tinstaafl
0
464
Member Avatar for සශික
Member Avatar for සශික
0
736
Member Avatar for Mr.M
Member Avatar for tinstaafl
0
848
Member Avatar for aalekh

The C Standard Library(stdlib.h) includes [qsort](http://www.cplusplus.com/reference/cstdlib/qsort/) which can be used to sort an array. That library also includes a binary search function([bsearch](http://www.cplusplus.com/reference/cstdlib/bsearch/)).

Member Avatar for rubberman
0
2K
Member Avatar for COKEDUDE

Another way would be to use Dynamic Memory Management([calloc](http://www.cplusplus.com/reference/cstdlib/calloc/), [malloc](http://www.cplusplus.com/reference/cstdlib/malloc/), [realloc](http://www.cplusplus.com/reference/cstdlib/realloc/), [free](http://www.cplusplus.com/reference/cstdlib/free/))

Member Avatar for David W
0
217
Member Avatar for Wynand

Here's one way using LINQ: Private Sub buttonSave_Click(sender As Object, e As EventArgs) Dim filePath As String = Me.TextBox1.Text Dim delimiter As String = ";" Dim sb As New StringBuilder() 'create columnNames: sb.AppendLine(Join((From c As DataGridViewColumn In DataGridView1.Columns Where c.Visible = True Select c.HeaderText).ToArray, delimiter)) 'get values from visible columns …

Member Avatar for tinstaafl
0
1K
Member Avatar for can-mohan

To get arbitrary positioning, you'll probably need something like a vector, which is basically a dynamic array. What are your requirements? Perhaps you'll be able to get better ideas.

Member Avatar for JamesCherrill
0
309
Member Avatar for David_66

Not sure if you have a problem or if this is supposed to be a snippet. However, one thing I noticed, you are accepting user input without verifying its validity. Using the TryParse method instead of the Parse method would help in this. Something like this: do { Console.Write("Ener Regular …

Member Avatar for JOSheaIV
0
940
Member Avatar for ratonhnaketon

One thing I see, is that you're passing the `moved` array to the print function incorrectly: print(n,moved); Without any sort of error message, it's hard to say if that is the problem though.

Member Avatar for tinstaafl
0
372
Member Avatar for can-mohan

Biggest problem I can see, is that you are trying to pass a binary function to the for_each function that is expecting a unary function. That's besides the syntax error(semi-colons instead of commas), typing error(2 p's in employee) and missing reference(#include <algorithm>). Also when using an object like that you …

Member Avatar for can-mohan
0
3K
Member Avatar for Mr.M

If you're writing for only windows, one way would be to use the .net libraries. With the latest version of Visual Studio you get fairly good realtime syntax handling and Intellisense as well as being able to create a C++ project that will interact directly with the .net librairies, that …

Member Avatar for tinstaafl
0
246

The End.