2,045 Posted Topics

Member Avatar for avarionist

FunctionX ([url]http://www.functionx.com/vccli/index.htm)[/url] has some decent tutorials for learning the C++/CLI language (the dialect of C++ used with the .NET library) but their winforms tutorials lag behind a version or two. It seems to be far easier to find C# references for this. I looked for a bit and couldn't find …

Member Avatar for avarionist
0
174
Member Avatar for God Coder123

Store them in a std::vector and use a while loop to get the input: [code] int temp; while(cin >> temp) { vec.push_back(temp); } [/code] and have the user push ctrl-z (or ctrl-d on *nix) when they are done.

Member Avatar for jonsca
0
106
Member Avatar for YasaminKh

Rather than use itoa which is non-standard try nbaztec's stringstream method: (portions omitted) [code] #include <sstream> //... std::stringstream ss; for { for { for { ss.str(""); ss<<i<<","<<j<<","<<k; std::cout<<ss.str()<<std::endl; } } } [/code]

Member Avatar for YasaminKh
0
190
Member Avatar for DelilahDemented

There are a few options and probably some others that I have forgotten about. The easiest is to keep the program like you have it (although you have a mismatch in the if/else pair which needs to be fixed) and after you've stepped through the char array with the while …

Member Avatar for Taywin
0
2K
Member Avatar for allonline

Please use code tags [noparse][code] //code here [/code][/noparse]. Your sort function is not actually sorting anything. You should pass in the array of structs and not return anything. Look up bubble sort and you should find lots of examples, but basically you do [code] temp = a a = b …

Member Avatar for Taywin
0
149
Member Avatar for mybluehair

Does the output from your first section of code come out correctly? See if you can pinpoint where in the process the garbage is printed. If the output for that first section is not correct check and make sure your arrays are holding that many elements.

Member Avatar for nbaztec
0
406
Member Avatar for allonline

The approach will be exactly the same as in your other thread ([url]http://www.daniweb.com/forums/thread292268.html[/url]). Are you having a specific problem implementing what those other posters suggested?

Member Avatar for peter_budo
0
342
Member Avatar for mohamedhassan

Within the body of a button click method (of a button with the text "Open" or some such) [code] openFileDialog1->InitialDirectory = "C:\\"; //set the initial directory for the dlg openFileDialog1->Filter = "All Files(*.*)|*.*"; //set a filter for the types of files openFileDialog1->FileName = ""; //leave the textbox blank Windows::Forms::DialogResult dr …

Member Avatar for jonsca
0
129
Member Avatar for TheBattlizer

It might work if you use the partial keyword. In the first file: [code] namespace DaniWeb { public partial class MyClass { public int Method1() { } } } [/code] In another file: [code] namespace DaniWeb { public partial class MyClass { public void Method2() { } } } [/code] …

Member Avatar for jonsca
0
96
Member Avatar for leone86

Can you be more specific about what's wrong? Line 22 for example is an error -- you don't need the equals sign.

Member Avatar for Radical Edward
0
113
Member Avatar for Buolbear4444

What was the error in CMake? There may have been some component missing that you needed. Also, the CMake 2.8 (EDIT: Seems to be the most current) only has entries for MS compilers up to VC++ 2008 which may also be a problem. VC++ 2008 Express is still available I …

Member Avatar for jonsca
0
149
Member Avatar for Jennifer84

[icode] MouseEventArgs::Empty [/icode] is of type [icode] System::EventArgs^ [/icode] so you must use a [icode] dynamic_cast<MouseEventArgs^>(MouseEventArgs::Empty)[/icode] to get it into the right form. However, with sending in an empty eventargs you won't have any information to provide to your MouseUp event. Perhaps there is some other way to evoke this, …

Member Avatar for jonsca
0
82
Member Avatar for Finconizer

[QUOTE=daviddoria]For that question, I'd start here : [url]http://www.daniweb.com/forums/forum4.html[/url] However, I'd ask why you would want to use such an old language?[/QUOTE] Next time this happens just hit the Flag Bad Post button to get it moved rather than having the OP repost the same question (not to speak for mods …

Member Avatar for nbaztec
0
148
Member Avatar for dhruv_arora

It doesn't seem as if you've included [icode] <iostream> [/icode] for cin and cout. Even after including that you will also need to qualify the names. You can do this one of three ways. First, qualify as [icode] std::cin[/icode] and [icode] std::cout [/icode] at each use of cin/cout, or alternatively …

Member Avatar for Ancient Dragon
0
349
Member Avatar for web3
Member Avatar for fernandofranca

The delimiter needs to be a character not a string, so try putting [icode] ':' [/icode] instead of [icode]":"[/icode] on line 36.

Member Avatar for fernandofranca
0
982
Member Avatar for zismad

Have the constructor in your serial port class take in a TextBox (and have a private TextBox field to hold the object). When you instantiate your serial port class in Form1, pass in the TextBox from your form.

Member Avatar for zismad
0
125
Member Avatar for Leppie

Reread Banfa's post as he has given you the answer. Specifying [icode] map[1][1] [/icode] gives you a pointer to the row on line 28 in the code above, so it is of type [icode] int * [/icode]. You need the third dimension in there for "map" to resolve down to …

Member Avatar for Leppie
0
184
Member Avatar for catalyst491

This sounds like a situation that calls for a backgroundworker object [url]http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx[/url]. That being said, part of the problem you were having above is that you need to pass in a [icode] System::Windows::Forms::Form [/icode] instead of a Form1.

Member Avatar for daviddoria
0
206
Member Avatar for Ayaat Monem

Can you provide an example of what you are looking for? Are you asking about wrapping up your game code in main in a while or do/while loop so you allow the user to repeat playing?

Member Avatar for Ayaat Monem
0
148
Member Avatar for Martje

[QUOTE=Martje;1243426]How do i load a text file to a windows clr textbox?[/quote] Using a [icode] System::IO::StreamReader object [/icode] and it's [icode] ReadToEnd() [/icode] method. This will give you a [icode] String ^ [/icode] to which you can set your textBox1.Text. [quote]and how do i save the lines of the textbox …

Member Avatar for Martje
0
128
Member Avatar for highflyer8

Firstly, thanks for posting neat, organized, well commented code as that is definitely appreciated around here. It's helpful for you to write out your questions instead of leaving them in the comments, though. In looking over your program, one error that sticks out (there may be more that I missed) …

Member Avatar for jonsca
0
116
Member Avatar for Martje

A richtextbox has a member Lines which is an array of all the lines of text (so Lines[0] would be the first line, etc). So yourRichTextbox->Lines->Length gives you the total number of lines. So you can do something like [code] for (int i = 0;i<richTextBox1->Lines->Length;i++) { if(richTextBox1->Lines[i]->Contains("findme")) MessageBox::Show("Found it at …

Member Avatar for jonsca
0
820
Member Avatar for slowlearner2010

I'm a rank amateur in terms of databases but overall it looks to me like you are trying to compile MFC code with the express edition which does not come with that feature.

Member Avatar for Ancient Dragon
0
298
Member Avatar for BobbieJean

Add in a set of braces between line 71 and 72 and between 73 and 74. This isn't tha main problem but your enqueue was happening regardless of the length. Trace through your portion that prints out the queue in the driver. After the queue is cleared and the 10 …

Member Avatar for BobbieJean
0
265
Member Avatar for jephthah

Geez... I'm...shocked. Yeah. :D I knew you'd be back. I'll bet you've been browsing C without logging in.

Member Avatar for William Hemsworth
3
854
Member Avatar for jackman05

This has a step by step method: [url]http://www.ehow.com/how_5079317_calculate-inverse-matrix.html[/url]

Member Avatar for mrnutty
0
317
Member Avatar for Brandon515

There are a couple of problems. getline in the form that you have it on line 45 (with the filestream as a parameter instead of as the object) takes a std::string for the second parameter. Your second parameter is an int. You can either read it in as a string …

Member Avatar for jonsca
0
148
Member Avatar for BobbieJean

You're calling the functions within themselves so it's going to proceed through those calls until the stack space runs out. isEmpty() will call isEmpty() which will call isEmpty()...etc. [I]ad nauseum[/I]. You have a variable that keeps track of the number of items on your stack, use that in your method …

Member Avatar for jonsca
0
138
Member Avatar for Leppie

Use a stringstream to create the filenames. [code] #include <sstream> stringstream ss; ss<<filenamestring<<number<<".txt"; //number is the int from your loop index [/code] Then use the .str() method of the stringstream to get the string in conjunction with the .c_str() operator of the string to get the char * that the …

Member Avatar for Leppie
0
2K
Member Avatar for JaimeSharp

Here's a skeleton for you to follow: [code] //#includes up here bool myFunction(string arr[],double darr[]); //the names of the parameters are optional //in the prototype int main() { string strarray[300]; //initialize these if you need to double dblarray[300]; bool result; result = myFunction(strarray,dblarray); //no types here for parameters or return …

Member Avatar for JaimeSharp
0
263
Member Avatar for tonymuilenburg

See [url]http://www.windows-tech.info/18/504d408117484041.php[/url] for a great reference. Normally in C# I would add in another .resx file but there doesn't seem to be a way to do that in 2008 or 2010 Express Editions. You can add them to the existing Form1.resx (the IDE will balk at you): open that file …

Member Avatar for tonymuilenburg
0
1K
Member Avatar for JaimeSharp

I'll offer the same advice as before. You have your working function now, so get your menu function working independently and add things in one by one, compiling in between. Line 40 is not going to do anything. Lines 50 and 51 are going to overrun the array bounds. On …

Member Avatar for JaimeSharp
0
124
Member Avatar for BlackNinja

Create a private int within your Form1 class (or could be public, if you needed that) and increment it in your button_Click method.

Member Avatar for bbman
0
92
Member Avatar for leesho

Lines 6-8 are the prototypes and they need the types of the variables e.g., [icode]void readThreeNumbers(float number1, float number2, float number3);[/icode] (in the prototype the names number1,number2, and number3 are optional, not the types). Since you are passing the float variables into your functions anyway, and because global variables are …

Member Avatar for leesho
0
184
Member Avatar for mahdi68

Array size must be a constant determinable at compile time (yours requires the user to enter numbers at run time). You can dynamically allocate your array with [icode] int * array = new int[c]; [/icode]. Some compilers have extensions to their C compilers to do what you did but the …

Member Avatar for jonsca
0
120
Member Avatar for iamcreasy

Check your "character.h" and see if you have a semicolon after the class declaration (I didn't download your project).

Member Avatar for iamcreasy
0
161
Member Avatar for carrythe1

What is generating [quote][code]<filetodisplay system string>[/code][/quote] ? [quote]the only thing i can think of that is causing the error is recursivity[/quote] Is there a proper base case for it? (I would think this would generate some kind of stack problem instead of the invalid parameter, though)

Member Avatar for carrythe1
0
1K
Member Avatar for RAVI KOTHARI

Could you clarify your question with an example of this situation?

Member Avatar for jonsca
0
35
Member Avatar for Ral78

When declaring an array, the length must be a constant known at compile time. What you are using here is a language extension for C compilers that allows a "variable-length" array to be defined statically. The downside is that your solution will be non-portable and non-standard as not all compilers …

Member Avatar for Ral78
0
150
Member Avatar for Ayaat Monem

Sorry restrictment, because that is "ASCII art" he's talking about, making shapes/pictures out of ASCII characters. [URL="http://en.wikipedia.org/wiki/ASCII"]ASCII[/URL] is the American Standard Code for Information Interchange. Contrast it with a slightly older standard like [URL="http://en.wikipedia.org/wiki/EBCDIC"]EBCDIC[/URL] (which I think still exists on some mainframes). From my understanding of it, if your system …

Member Avatar for abhimanipal
0
278
Member Avatar for Sandhya212

You can use a stringstream([url]http://www.cplusplus.com/reference/iostream/stringstream/[/url]). Remember to call [icode] mystringstream.str(""); [/icode] at the beginning of your loop to clear it out (otherwise all the filenames will get stuck together as you go). Also, remember that ofstream takes a const char* for the filename so you need to use the .c_str() …

Member Avatar for Sandhya212
0
221
Member Avatar for RossSCann

This thread has a bunch of different suggestions: [url]http://social.msdn.microsoft.com/Forums/en-US/msbuild/thread/40ed753e-47af-4638-8a72-1d607102a05c[/url] I've never run into that problem personally, though.

Member Avatar for RossSCann
0
100
Member Avatar for Theanonymous
Member Avatar for Theanonymous
0
133
Member Avatar for mrnutty

You forgot to ask "Would you like source with that?" Let's hope it's legit :D I'd be interested to know which approximation you were using and stuff.

Member Avatar for NathanOliver
2
168
Member Avatar for Chris11246

Try it without the Empty Project setting on. Empty starts it without some of the settings that you need (not sure which ones precisely). Just put your code into the [yourprojecthere].cpp file when the project is created. I'll have to look around the menus a bit more but I'm not …

Member Avatar for Chris11246
0
119
Member Avatar for daviddoria

There's a 30 minute window during which you can edit it. If you're looking for the edit button it's on the left under Flag Bad Post.

Member Avatar for Biker920
0
106
Member Avatar for perroned

Grid_pos[2][2] is a single char but you told Print_Grid to expect an array with second dimension 2. If you want to print the whole grid make the function definition [icode] void Print_Grid(int i, int b, char Grid_pos[][3]) [/icode] and pass in [icode] Print_Grid(i,b,Grid_pos); [/icode] so that you get a pointer …

Member Avatar for perroned
0
296
Member Avatar for Dani

[quote]Stuff doesnt show up right for me on IE6 [/quote] Wow I know some businesses hung onto it for way too long because it was part of their old infrastructure, but time to upgrade that puppy.

Member Avatar for The Dude
2
190
Member Avatar for shrutinr

One way to do it is to have your project2 constructor take a variable of type TextBox. When you instantiate project2 from project1, pass in the textbox from project1. If you're launching them the other way around change the constructor in project1 to receive the TextBox. "Form1.h" [code] #include "Form2.h" …

Member Avatar for jonsca
0
169

The End.