C# :: Get Item From List In Another Class

Jan 15, 2014

How can I get the items from a list into textboxes. I am doing an windows form application in visual studio.

I have the first form with a couple of textboxes.

I want the inputs be saved in a list. And then displayed in another form. How to move on. The class with the list looks like this:

public class Casecs {
public List<caseInformation> fallInformation = new List<caseInformation>();
public class caseInformation {
public string caseId { get; set; }
public string phoneNumber { get; set; }
public string description { get; set; }
}

Then the form with the inputs in textboxes looks like this:

Casecs Casecs = new Casecs();
Casecs.fallInformation.Add(new ERIS.Casecs.caseInformation {
caseId = txtCaseId.Text,
phoneNumber = txtPhonenumber.Text,
message = txtMessage.Text
});

Then where I am stuck a form with some textboxes where I want the list items to be displayed:

public partial class btnDispatch : Form {
public btnDispatch() { }
public btnDispatch(List<Casecs.caseInformation> fallInformation) {
InitializeComponent();

View 7 Replies


ADVERTISEMENT

C# :: Create A Button For Each Item In A List

Jan 26, 2014

Basically, the program is just sort of a soundboard. The way it is now, it just reads all the names of the files in a particular folder (all .wav files), and then adds an entry to a listBox for each file found. What I would like to do, is instead of a listBox, have buttons for each one. Is there any way to iterate through a list of items and create a button for each one? The main problem I see is placing the buttons. It would have to have some sort of grid to place them in I would imagine...

View 3 Replies View Related

C++ :: Removing First Item From Single Linked List

Oct 10, 2013

My algorithm is not working

void remove_first() {
current_node = head_node;
node * temp_node = current_node;
current_node = current_node->get_next();
head_node->set_next(current_node);
delete temp_node;
temp_node = NULL;
}

View 2 Replies View Related

C/C++ :: Linked List Insert Item Function

Oct 14, 2014

It is suppose to insert items in Linked List in sorted ascending order and no duplicates are allowed.The code complies but it creates duplicates out of order.

ListRetVal CSortedList :: InsertItem(const ListItemType &newItem)
{
ListItemNode* newLNode = new ListItemNode();
newLNode->value=newItem;
newLNode->next=NULL;

[Code].....

View 5 Replies View Related

C# :: Sharing Item List Object Between Two Forms

Nov 4, 2014

I've changed up my code to the retail checkout WFA I am trying to make. I have an item list filled with objects of the now globally accessible 'Item' class, but I'm having trouble.

Essentially, I want to send an object of the item class chosen from a dropdown menu to form2, where I will fill in certain blank attributes with data entered in form2's text boxes and comboboxes. The problem, it seems, is I need another itemlist in form2 that will hold the object being passed to form 2, so I can then pass all the information to textboxes on form3 (the receipt/review page). It's been more than a year since I coded with C#, and I've forgotten quite a bit. I was also not able to find any tutorials on building an item list without an associated combobox or droplist, which is what I need.

This is my item class (minus most of its properties so the page doesn't stretch).

class Item {
public string prodName;
public string fName;
public string lName;
public string ccNum;
public string ccProv;
public string shipAddr;

[code] ....

For anyone who didn't see my last question, I'm in a User Interface Design class, not a C# class. I know this probably isn't the best code out there, but for my purposes the program just needs to compile beginning to end and pass the data like it should.

View 1 Replies View Related

Visual C++ :: Get The Path For A Selected Item In A List Control?

Jan 29, 2013

How do I get the path for a selected item in a list control?

View 5 Replies View Related

C# :: Open WPF Window From Double Click On Selected Item In A List?

Apr 23, 2015

I have a list with 2 items in it. When I double click on item 1, I want to open Window1.xaml, when I double click on item 2, I want to open Window2.xaml...

The code below works for popping up a message box, or window for that matter. But I really need to get the Window1 and Window2 based on the clicking of the correct selected item in the list.

Here is some code:

<ListView d:DataContext="{d:DesignData }" Name="PharmacyLv" IsSynchronizedWithCurrentItem="True" l:Sortbehavior.CanUserSortColumns="true" >
<ListView.ItemContainerStyle>
<Style TargetType="ListViewItem">
<EventSetter Event="MouseDoubleClick" Handler="ListViewItem_PharmDoubleClick" />
</Style>
</ListView.ItemContainerStyle>

[code].....

View 3 Replies View Related

Visual C++ :: Enable / Disable Menu Item 2 In OnUpdate Handler Of Menu Item 1?

Sep 15, 2014

I have two menu items. When item 1 is disabled, I want item 2 to be disabled as well. In the OnUpdate handler of menu item 1, I have tried to use "t_pMenu = pCmdUI->m_pMenu;", "t_pMenu = pCmdUI->m_pSubMenu;" and "t_pMenu = pCmdUI->m_pParentMenu;" but I always get NULL t_pMenu. How can I achieve this purpose?

Code:
void CDummyView::OnUpdateMenuItem1(CCmdUI* pCmdUI)
{
if(m_bShowMenuItem1) {
pCmdUI->Enable(TRUE);

[Code]....

View 14 Replies View Related

C++ :: Splitting In A Linked List Class

Mar 9, 2013

I'm trying to develop a program that stores a list of hw assignments in the form of "Date,Assignment name,grade". I have functions that add,remove, and delete from a list, but I would also like to search and delete a particular date found in the list. From here, split - Splitting a string in C++ - Stack Overflow I've tested Evan Teran's method to split a string, but I'm unsure of how to implement it in my code.

List.h Code: #ifndef LIST_H
#define LIST_H
#include <string>
using namespace std;
class List{

[Code] .....

View 14 Replies View Related

C++ :: Creating Methods For Class List?

Jul 3, 2013

Creating the methods for class List

main.cpp Code: #include "List.h"
int main( )
{
List la; // create list la
la.push_front( "mom" );
la.push_back( "please" );
la.push_back( "send" );
la.push_back( "money" );
la.push_front( "hi" );
cout << "
la contains:
" << la << '

[code]...

View 12 Replies View Related

C++ :: Using Array Initialization List For Own Class

Jun 17, 2014

i'm currently working on a research project and i've been given some specifications

Is there a way i can access/use the array initialisation list i.e

{value,value,value}; .

For my own class? Like this

myclass foo={value,value,value};

View 3 Replies View Related

C++ :: Trying To Add Template Class To Maintain List

May 12, 2013

I wrote this menu-driven program that maintains a list of restaurants. The program runs fine as it is right now, but my problem is I need to create a new array template class to maintain the list of restaurants, and when a new restaurant is added it must be created dynamically.

I'm having a hard time figuring out what exactly I need to do for this. Templates confuse me allot and I've read all the sections on templates here and in my book, but i'm still lost. The dynamic memory part is throwing me off as well.

main.pp

#include <iostream>
#include <string>
#include <iomanip>
#include "Restaurant.h"

[Code]....

Restaurant.h

#pragma once
#include <iostream>
#include <string>
#include "FTime.h"
using namespace std;

[Code]....

Restaurant.cpp

#include "Restaurant.h"
#include <iostream>
#include <string>
#include <iomanip>
#include <sstream>
using namespace std;

[Code]...

FTime.h

#pragram once
#include <string>
using namespace std;
//class FTime
class FTime {
friend ostream& operator<<(ostream& out, const FTime& obj);

[Code]...

View 3 Replies View Related

C++ :: List Class With Student Type?

Jul 3, 2013

I am trying to use a class Student and declare it as a list type. I can pushback but without changing the List.h or Node.h how can I print the data in list2?

Node.h
#ifndef NODE_H
#defineNODE_H
#include <string>

[Code].....

View 6 Replies View Related

C/C++ :: Sequence Class With Linked List?

Apr 10, 2014

my data structures and algorithms professor gave us the following assignment. We are to reimpliment a class we wrote earlier in semester called sequence(which holds a sequence of floats) using a linked list. However I am having trouble with the class's copy constructor and assignment operator, specifically when the sequence is not empty.

links to google drive files

node
node header file
test program
sequence implmentation
sequence header file

View 10 Replies View Related

C++ :: Making Templated Class Of List?

Apr 19, 2014

I'm trying to make an templated class of List and trying to make a list of Students(another class) which I made. Its not working.

Code seems to work fine for pre-defined data types but it crashes when it comes to students. I also want to run sort function on list of students.

View 1 Replies View Related

C# :: Unable To Access List Class

Mar 3, 2015

how would i access the list created,i should be able to access the list from all other class, adding to it update ect ect.

class test2
{
public string FirstName{ set; get; }
public string LastName { set; get; }
public string Location{ set; get; }
private List<test2> myList = new List<test2>();
public override string ToString()

[code]....

now in a seperate class how would i view the item (print in console) and edit 'mike' location to XYZ.

View 6 Replies View Related

C/C++ :: How To Use The List Container To Hold A Class

Dec 11, 2013

How would I use the list container to hold a class?

class A {
    private : int x;
    public  : void setX(int val) { x = val; }
};  

class B {
    private : std::list<A> pdata;
    public  : void addToList();
};  

For adding, I thought of trying something like

void B::addToList() {
   A *tmp = new A;  
   if(A != 0) {
      tmp->setX(5);
      pdata.insert(tmp);
      delete tmp;
   }
}

How would I do what I'm trying to do? Or is this the wrong way to go about it? For the actual program, "B" would contain several lists of various classes.

View 2 Replies View Related

C++ :: Function To Manipulate Data From A List Class

Feb 3, 2013

I made a program that can use a function to manipulate data from a list class. The program is very basic and I think the error makers may be obvious to some of you. I just wanted to find it without having to scrap my program. It doesn't generate a compile error but it announces a memory error while it is running. I use visual studio 2012, the program is an exercise from a c++ book.

list.h
#ifndef LIST_H_
#define LIST_H_
typedef double Item;
const int MAX = 10;
class List

[Code] .....

View 4 Replies View Related

C++ :: Linked List Class Node Implementation

Mar 26, 2014

I am studying this sample code for linked list class node implementation. I am not 100% sure how this code keeps track of the head node. Here's what I know so far, and if you want to add/correct anything feel free to do so:

class Node {
public:
Node(); // constructor of class node without arguments
Node(int, Node*); //constructor with arguments of int type and a pointer node type
Node* next() const;
void setNext(Node*); //member fun, returning a pointer of node type
void setKey(int);

[Code] ......

View 8 Replies View Related

C++ :: Making List Of Champions - Vector Of Class

Oct 6, 2013

I am making a simple program that is suppose to make a list of champions and their items from the game League of Legends. I am stuck on making a vector of the class so each slot within the vector would hold each champion and its data. This is what I got:

Champion_Info.h

#ifndef CHAMPION_INFO_H_INCLUDED
#define CHAMPION_INFO_H_INCLUDED
#include <vector>
#include <string>
using namespace std;
class Champ_Info

[Code] ....

View 3 Replies View Related

C++ :: Setting Up Linked List Class With Templates?

Dec 2, 2013

I am trying to implement a linked list using a class template, however each of my classes that I want in the list all inherit from an Account class. I have attempted to template the linked list class as account however Ive come into errors I can't resolve. How I can go about this?

The error exists within the customer.cpp class where it says

14IntelliSense: a value of type "Account *" cannot be assigned to an entity of type "CurrentAccount *"f:Further C++Assignment with TemplatesAssignmentCustomer.cpp229Assignment

Customer class:

#ifndef CUSTOMER_H
#define CUSTOMER_H
#include <iostream>
#include <string>
#include "Account.h"
#include "AccountLinkedList.h"

[Code] .....

View 2 Replies View Related

C/C++ :: Making New Class Instance And Adding To Linked List

Oct 31, 2013

I have a .cpp file which contains 5 smaller defined classes. In my missile class I have a default constructor and a constructor that I invoke

class Missile{
private:  
bool isHuman;

[Code]...

My issue is when creating and adding the pointer object; it doesn't seem to create a new instance of the class-the Missile objects all share the same xPos value which is always the first xPos when the "fire" command is given. The "Missile *missile = new Missile(xPos, yPos, true);" line does not seem to create a new instance of the object with different variables but instead creates a new object with the same variables. Is it necessary for me to always make a separate .cpp and .h file for any class I want to create multiple instances of or can I keep the smaller classes in the same file and still create a new separate instance of the class?

View 3 Replies View Related

C/C++ :: How To Define Default Constructor For A Template List Class

Apr 18, 2012

I was making a template list class, and using it to make list of objects of my own class.It works fine with integers, but not with other classses.

template <typename T>
class CList {
public:
    struct Node {
        T data;
        Node* next;

[code]....

While in AddElement(), it gives error - Default constructor not available.

template<typename T>
bool CList<T>::AddElement(T t) {
    bool result = true;  
    if (head == NULL) {

[code]....

what is wrong here.

View 1 Replies View Related

C++ :: Sorting Program That Uses Variables From Another Class - List Not Declared In This Scope

May 13, 2014

I've got this sorting program that uses variables from another class but I'm not sure why its not recognizing it. I'm getting an error length and list not declared in this scope.

#include <iostream>
#include "arrayListType.h"
using namespace std;
template<class elemType>
class orderedArrayListType: public arrayListType<elemType> {

[Code] ....

View 1 Replies View Related

C++ :: Compiler And Linker Errors For Linked List Class And Application

Aug 31, 2014

I am trying to write a program that will take a list of integers from a file and write them to another text file. I've been banging my head at this for days trying to get it to compile as it is riddled with linker and compiler errors.

**************************header*************************

#ifndef LINKEDLIST_H
#define LINKEDLIST_H
#include <iostream>
using namespace std;
template <class T>
class linkedList {

[Code] ....

View 6 Replies View Related

C++ :: Creating A Class That Would Implement Concept Of Double Linked List Like A Queue

Jun 15, 2013

Well, basically, what I've been doing was creating a class that would implement the concept of Double Linked List, but that would behave like a queue ( the STL implementation is deque, or Double Ended Queue ).

The problem occured when I have been trying to generalize the class using templates. I mean, why use only integers ? Why not double or char or what not ?

Worked perfectly before including all the template stuff..

// Source.cpp <=> Main.cpp
#include <iostream>
#include "DList.h"
using namespace std;
int main(void) {
DList<int> *list;
list = new DList<int>();

[Code] .....

The errors returned by the compiler:

Error1error C2955: 'Node' : use of class template requires template argument listc:usersjumperdesktopc++ otherdouble linked listdouble linked listdlist.h6
Error2error C2955: 'Node' : use of class template requires template argument listc:usersjumperdesktopc++ otherdouble linked listdouble linked listdlist.h6

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved