Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Nov 2007
Offline Last Active Today, 01:37 PM

Topics I've Started

C++ Need help with fstream

Yesterday, 09:20 PM

I need help with fstream and linked lists. Basically I am creating a basic inventory program for a school project where I have to write a manual for it. What I am trying to do is store products in a linked list. When the user quits, it writes stores the data into a txt file. When the user opens it again, I want it to read from the text file to re-populate the list. The problem I am having is reading a line with spaces. I can get it to read once, but when it goes to the next list, it doesn't copy all the information from the second product. Below is all the code I have so far and commented out what I have tried. The problem lays in LinkedProductInventory.cpp in the constructor.












EDIT: Here is what the txt file looks like:

Test this

having a couple of problems with Windown Forms

14 January 2014 - 08:53 PM

I have been having two problems that have been nagging with Windows Forms. One being the visibility modifier and updating a list box. To start off, I had trouble getting the menu strip highlight colors to change to what I wanted them to be. Fixed that by creating a new class that inherits from MenuStrip and then adding it to the main form. The program (more like game) is using several different panels to display different information and navigation controls. So instead of creating a bunch of different panels in the main form and setting the visibility to false until a button is pressed (putting a bunch of code in one place), I decided to make each panel a user control class (which automatically inherits UserControl). My problem with the visibility modifier is that I had to add each user control to the main form as public static in order for the other controls to set the visibility modifiers. Is there another way to implement something so I don't have to add all the user controls to the main form as public static?


The other problem I have is updating a listbox from one user control when I press a button on a different user control. Basically I have a user control which displays info from a list on a listbox with add, modify, delete buttons. When the user clicks add, they are taken to another user control to input the info they want. However, when they click save, I want to update the listbox with the added info. I tried to make the listbox static and have tried both class.listbox.DataSource = null then class.listbox.DataSource = list. That didn't work. Then I tried class.listbox.Refresh(). That didn't work as well.


I was thinking about maybe trying to use and Interface, but I am not exactly sure how they work or how to use them. To me, they seem like just a way of organizing like classes in order to save time typing a bunch of methods, but don't interact with each other.


Any help would greatly be appreciated.

Need help creating new objects based on user input

07 January 2014 - 09:25 PM

I am playing around with windows forms and was wondering if there was a way to create a new object based on user input. Basically I want to be able to create a new object with what ever the user puts into the make textbox, add it to a List<Car>() and then display the model in the listbox. Just need to know if there is a way to make an object without knowing the name (such as Car xxx = new Car(make, model, year)) or knowing how many objects will be created and be able to pass in parameters. Below is the code for the simple car class and a screen capture of the program:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CreateNewObjectsTest
    class Car
        private string make;
        private string model;
        private int year;

        public Car(string make, string model, int year)
            this.make = make;
            this.model = model;
            this.year = year;

        public string GetModel()
            return model;

Getting user input for word search game

23 November 2013 - 09:27 PM

I need some help in getting user input for a word search game I am making in Java using swing. I have everything working and displaying properly such as the game board and the words the user has to find. I am using a 2D array of JPanels to display the individual letters. What I would like to do is draw an oval where the starting point is where the user thinks the beginning of the word is, and then release it when the user is over the end of the word. How would I get the letters of the word in between the clicks? Any help would be greatly appreciated.


Here is the link to my pastebin where the code is for all the classes I am using.

Help with some problems with word search game

21 November 2013 - 07:33 PM

I am having some trouble with a word search game I am making in Java. For starters, when I click on new game in the menu bar, it draws the puzzle just fine. However, if you click it again, it doesn't draw the new puzzle. I know it is drawing the puzzle because I have it displaying in the output window, it's just not drawing on screen.
My other problem really isn't a problem, more of a question. How would I go about highlighting the user's selection? I know I should be using the MouseListener, however, how would I snap that to the 2D array that has the puzzle?