C# :: Display Data In Text Box Based On ID

Dec 23, 2014

I have a area in my Project where i need to display a title and content in two text boxes. The Data base tables are:

ID | Title | Content

This is what I have so far, I know I am on the right track, I just cant figure out how to get each box to display based on the ID.

private void frmMain_Load(object sender, EventArgs e){
try {
string connStr = ConfigurationManager.ConnectionStrings["sdcAssistDB"].ConnectionString;
OleDbConnection dbConn = new OleDbConnection(connStr);
dbConn.Open();

[Code] ....

View 3 Replies


ADVERTISEMENT

C++ :: Pointer-based Data Loading From A (text) File

Dec 4, 2013

I have two classes, productListType and buyerListType, that are each basically linked lists. To create the linked list for an object of productListType, I successfully wrote a non-class function createProductList to read the product data from a text file. The class definition for buyerListType has a data member productBoughtRecord that is of type productListType to aggregate the details of the products purchased by a particular buyer during transactions. I decided to make productBoughtRecord a pointer since the contents of this data member would wax and wane over the course of several transactions, depending on the amount and frequency of payments made by the buyer. I have provided a rough sketch of the class below:

class buyerListType
{
public:
setCustomerInfo( ....., productListType* p);
.
.
.
private:
productListType* productBoughtRecord;
.
.
};

I'm similarly trying to write a non-class function createBuyerList to load the record of customers from a text file. How do I determine what the value of the formal parameter p in member function setCustomerInfo is, in order to be able to set the data member productBoughtRecord? take into consideration that an object of class buyerListType would have multiple buyers with varying amounts of products purchased.

View 11 Replies View Related

Visual C++ :: Display Data Of Text File In List View

Sep 24, 2012

I want to display data from text file in list view and in tree view root will be file name, but i dont know how to do it, the problem is with displaying text file data in list view, i don't know anything about that. text file data is very simple. It is just a square matrix of double values like:

21.06 34.06 5.0
12.78 45.25 6.9
12.89 45.98 5.5

in list view i want to display it.

View 14 Replies View Related

Visual C++ :: CString - Display Some Data In Text Format On A Dialog

Aug 7, 2014

I am trying to display some data in text format on a dialog and I am using a CString to do it. Below is how I coded it.

Code:
CString outputStr;
CString auxStr;
// Add header
outputStr.Format("");
auxStr.Format("%-7s%-20s%-7s%-20s%s

[Code] .....

But the output rows are not aligned as shown in the attached picture. There a two problems.

1. Data rows don't align with the header row.
2. When the first element of a row changes to two digits, the other elements are shifted.

According to MSDN [URL] ...., CString::Format() works the same way as printf(). I wrote a small program using printf() to do the same thing, and the output in the console are perfectly aligned.

What have I missed when doing the display in GUI?

View 14 Replies View Related

C++ :: Tile Based Game Display

Apr 10, 2013

I have been writing a fairly simple turn based rpg game in c++ and at the moment it has a 2d integer array for the map, which I can display using periods for the blank areas and letters for the various people in the game, and I am trying to figure out how to upgrade to a tile based display.

View 3 Replies View Related

C++ :: Display All The Contents Of A File Excluding One Based On User Input

Mar 10, 2014

i want to display all the contents of a file excluding one based on user input say i have 4 records in the file numbered 1 to 4....the user chooses 2 to exclude it outputs records 1,3,4,4 when it should be records 1,3,4 what am i doing wrong here is the code.its basically displaying the last record in the file twice

void excludeRecord()
{
ifstream read;
read.open("Data.txt");
int recordC =0;
string fnameC = " ";
string lnameC = " ";

[Code]...

View 2 Replies View Related

C++ :: Display Fraction In Proper From Based On 2 Arguments Passed To Class Member Function

Mar 15, 2015

We're assigned a project working with classes and fractions. My goal is to display a fraction in proper from based on 2 arguments passed to a class member function proper();

My strategy was to utilize the greatest common factor between the 2 arguements, then divide both the numerator and denominator by that number and then it would display.

The program actually runs, but only seems to divide the numerator and not the denominator. This in return makes my other class member functions have incorrect comparisons and sums.

Code:
#include<iostream>
#include<conio.h>
class Fraction {
friend void compare(Fraction a, Fraction b);
friend void sum(Fraction a, Fraction b);

[Code] ....

View 14 Replies View Related

C++ :: Loop In A Text-Based RPG

Feb 13, 2013

I am working on my first RPG. Nothing fancy so far... I haven't developed a story or anything, just trying to get the gameplay hammered out. Anyway, I have a couple of NPCs and Items and I was wondering how I should program these interactive spots. I'm unsure whether I should loop the Room info or continue forward with if statements. With Items, I want to prevent the player trying to use the option to get the item again (after you pick up the item, the option is gone. Here are a couple examples of where I have the problem

else if(playerloc == 3)
{
cout << "There is a hooded figure in the corner. "
<< "The person waves you over.
";

[Code]....

What I want to do after the character interaction is complete is continue forward with the option to go south or east. I could return to the room menu, or continue by coding forward and allow the option to go east or south with more if-else-if chains..

In the next bit, I want to program the item to be picked up and then the treasure chest will be empty.

else if(playerloc == 5)
{
cout << "There is a treasure chest in the Northwest corner of this room.
"

[Code].....

View 1 Replies View Related

C :: Text Based Web Browser From Scratch

Sep 13, 2014

I have written a text based web browser from scratch. Meaning that I'm not using libcurl in any way to retrieve the web pages.Now I'd like to add HTTPS functionality to it, but I can't seem to find a guide like Beej's Guide to Network Programming related to HTTPS.

View 3 Replies View Related

C++ :: Text Based RPG - Object Not Being Created?

Oct 24, 2013

I'm currently creating a text-based RPG, to get myself back into learning C++ again. The problem seems to be with the if-else ladder of statements, the user selects which race they wish to play as, which as a result creates the appropriate object for that race.

This is the character selection option code:

std::cout << "Please select a race: Human [1], Elf [2], Dwarf [3] or Orc [4]
";
std::cout << "Race selection: ";
std::cin >> race_selection;
std::cin.ignore();
switch (race_selection) {

[Code] .....

The problem here is, regardless of which race I use using the above switch statement, the Human object always seems to be created, instead of the object for the desired race.

View 4 Replies View Related

C/C++ :: Display Data From File Into 2D Array - Print Closest Bmi From Data

Mar 28, 2015

#include <iostream>
#include <fstream>
using namespace std;
int main() {
int r = 0;
int c = 0;
int num[17][15] = { 0 };
[Code] ...

// Here is my code for displaying the data from the text file into a 2d array and height next to it, but I am not able to diaplay the height from 60 to 76 next to the row of the 2d array, as shown in the table below. This is my program:

Recently the health authorities have listed a new way to calculate the body mass index (BMI) of an individual.
Values of 20 – 24 are classified as normal, 25-29 as overweight, and 30-34 as heavy.

The table below is a portion of a typical BMI table.

BMI:202122232425262728293031323334
Height:
60102108113118123128133138143149154159164169174
61106111116122127132138143148153159164169175180
.
.
.

MY task is to write a program that does the following things:

1.Produce the table by reading in the data from bmi.txt (on Moodle) into a 2-D array.

2. Display the table neatly on the screen, with row and column headings. The BMI should go from 20 to 34. The height should go from 60 to 76 inches.

3. Prompt the use for their height (in inches) and their weight.

4. Make the program print the closest BMI.

If their weight is lower than the values on the table, use 20 as the BMI.
If their weight is higher than the values on the table, use 34 as the BMI.

5.Loop the program so the user can find more BMI’s.

View 7 Replies View Related

C++ :: Basic Parts Of Text Based RPGs?

Oct 22, 2013

How you'd type yes or no scenarios for a text based RPG? And I mean a really basic like 'you see ..... what do you do?'. Also, how would you finish a code like this.

View 9 Replies View Related

C++ :: How To Create Text Based Game Running On Console

Mar 12, 2013

I want to create a text-based game with C++, running on the console. I have made some other text-based console games.

Which is the most interesting text-based game to learn how to program for beginners?

View 2 Replies View Related

C++ :: Text Based RPG Game - Saving Integers And Strings

Jul 14, 2013

I am working on a text-based RPG game and I want to allow the player to save his progress. So I need to save several integers and a string. And my problem starts here "How can I save integers and load them?". I read the tutorial but I dont understand. I need to write a function to save game?

View 8 Replies View Related

C/C++ :: Text Based Game - Adding Players Names?

Mar 28, 2015

I am trying to make a very simple text based game and I want the players to be able to name their characters. Thus, I am trying to have the game ask "how many players will be playing:" and then taking that number (X) and create a place to store that information. I'm trying to get the game to ask, "What is the name of Player1?" Then once the user enters the name it would ask "What is the name of Player2" and that cycle would continue until PlayerX has entered their name. Is what I am doing close?

Here are the errors:

error C2143: syntax error : missing ';' before 'string'(ln 29 col 1)
Error2error C2678: binary '<<' : no operator found which takes a left-hand operand of type 'std::basic_istream<char,std::char_traits<char>>' (or there is no acceptable conversion) (ln 30 col 1)

int NumberOfPlayers;
if (Response1 == "Yes") {
cout << "
How many players will be joining us on our adventure: ";

[Code].....

View 9 Replies View Related

C++ :: Write Interactive Text Based Menu Interface (using A Loop)

Sep 27, 2013

Write an interactive text based menu interface (using a loop) that will allow the user to

Enter a task or assignment Display all of the tasks that are in the file Find a task by Course Quit For each task, you need to keep track of:

Course Name that it is for (e.g., CS162)
Description of the assignment (e.g., Finish Lab 2)
Due date (e.g., 9/26/2009)

Allow the program to keep looping until user wants to quit. When the program starts, it should load the tasks from external file ("tasks.txt") into memory. When user enters the three items of a task, the program needs to read them in, save them in memory and eventually write them to the external data file ("tasks.txt"). The file format could look like: (The ';' is used as a delimiter or field seperator.)

Some Implementation Requirements:

Write at least four functions WITH arguments for this assignment. Use struct named Task to model task Use array of structs to model the collection of tasks. Hint: In this assignment, the description and course name may have multiple words in it. Therefore, you now SHOULD read using the 3 argument version of get. Watch out. When using the 3 argument version of get you need to make sure to remove the delimiter or newline. Therefore, anytime you read (even a confirmation message), make sure to eat the newline! Make sure to have a delimiter written between each item in the file – like a newline. This will be important when you read the information back from the file.

This is my code so far:

#include <iostream>
int main()
{
char cname[25],desc[20];

[Code]....

View 1 Replies View Related

C++ :: Generate A Report Based On Input Received From A Text File

Nov 5, 2014

Here is the assignment... Write a program to generate a report based on input received from a text file. Suppose the input text file student_status.txt contains the student’s name (lastName, firstName middleName), id, number of credits earned as follows :

Doe, John K.
3460 25
Andrews, Susan S.
3987 72
Monroe, Marylin
2298 87
Gaston, Arthur C.
2894 110

Generate the output in the following format :

John K. Doe 3460 25 Freshman
Susan S. Andrews 3987 40 Sophomore
Marylin Monroe 2298 87 Junior
Arthur C. Gaston 2894 110 Senior

The program must be written to use the enum class_level :

enum class_level {FRESHMAN, SOPHOMORE, JUNIOR, SENIOR } ;

and define two namespace globalTypes (tys and fys) for the function :

class_level deriveClassLevel(int num_of_credits) ;

The function deriveClassLevel should derive the class_level of the student based on the number of credits earned.

The first namespace globalType tys should derive the class level based on a two year school policy. And the second namespace globalType fys should derive the class level based on a four year school policy.

Four Year School Policy:
Freshman 0-29 creditsSophomore 30-59 credits
Junior 60-89 creditsSenior 90 or more credits

Two Year School Policy:
Freshman 0-29 creditsSophomore 30 or more credits

and this is the code I have so far...

#include <cstdlib>
#include <iostream>
#include <cctype>
#include <fstream>
using namespace std;
enum class_level {FRESHMAN, SOPHOMORE,JUNIOR,SENIOR};
class_level classLevel;

[Code] .....

My main question is did I use the namespaces and enum correctly? And my second question is whats the best way to input the data from the text file? This is really where I get stuck.

View 3 Replies View Related

C++ :: Generate A Report Based On Input Received From Text File

Nov 7, 2014

Write a program to generate a report based on input received from a text file. Suppose the input text file student_status.txt contains the student’s name (lastName, firstName middleName), id, number of credits earned as follows :

Doe, John K.
3460 25
Andrews, Susan S.
3987 72
Monroe, Marylin
2298 87
Gaston, Arthur C.
2894 110

Generate the output in the following format :

John K. Doe 3460 25 Freshman
Susan S. Andrews 3987 40 Sophomore
Marylin Monroe 2298 87 Junior
Arthur C. Gaston 2894 110 Senior

The program must be written to use the enum class_level :

enum class_level {FRESHMAN, SOPHOMORE, JUNIOR, SENIOR } ;

and define two namespace globalTypes (tys and fys) for the function :

class_level deriveClassLevel(int num_of_credits) ;

The function deriveClassLevel should derive the class_level of the student based on the number of credits earned.

The first namespace globalType tys should derive the class level based on a two year school policy.
The second namespace globalType fys should derive the class level based on a four year school policy.

So I basically did it in parts and got everything working and then had to make the namespace so I had this:

#include <iostream>
#include <fstream>
#include <string>
using namespace std;
enum class_level { FRESHMAN, SOPHOMORE, JUNIOR, SENIOR };

[Code] ......

I know I have to clean it up and change it but it ran like it was suppose to. Then I tried adding the global namespaces and I this:

#include <iostream>
#include <fstream>
#include <string>
using namespace std;
enum class_level { FRESHMAN, SOPHOMORE, JUNIOR, SENIOR };
class_level classLevel;

[Code] ....

with this i keep getting an error saying tys::deriveClassLevel: must return a value and tys::fys::deriveClassLevel: must return a value. I have been messing around with this part and struggling I thought I used the namespace to run the if statements with the criteria for the years of school. Basically I have been stuck for awhile and trying to change things around but I cant seem to get it to work.

View 2 Replies View Related

C++ :: Create A Binary File Based On HEX Data

Apr 24, 2013

I want to create a binary file based on some hex data :

Ex Input Hex :54313032202020303030

Out put like :6      

View 2 Replies View Related

C++ :: Generate A Binary String Based On Hex Data

Apr 23, 2013

Generate a binary ascii characters(weird character ) based on Hex:54313032202020303030 data in C++

View 3 Replies View Related

C/C++ :: Change Data Based On Users Input?

Feb 7, 2014

Player is given choice of x number of Races This choice changes the player's base stats. Then player is given a choice of x number of Classes (archer, warrior, etc.) This choice determines how the player's stats will change upon leveling up.

#include <cmath>
#include <iostream>
#include <ctime>

[Code]....

View 7 Replies View Related

C++ :: How To Stop Outputting Data Based On A User Input

Sep 27, 2013

how to stop outputting data based on a user input. The text file is as follows:

1. a
2. b
3. c

and the code I'm using is as follows:

int main (){
string line;
int search;
cout << "Enter a number from 1-3" << endl;
cin >> search;
search++;
ifstream myfile ("example.txt");

[Code]...

What I want to do is to just output number 1 (the whole line) if the user enters number 1. However, I get an error on the second condition w/c is the "&& line!= search"

View 1 Replies View Related

C/C++ :: Quiz Program Based On Data File Handling

Dec 22, 2014

I'm trying to make a Quiz program based on C++'s Data File Handling capablities. I've attached the code in .txt file and I wonder why I'm getting the error identifier bScience cannot have a type qualifier?

Attached Files QuizPro.txt (9.6 KB)

View 7 Replies View Related

C++ :: Sorting Some Data Based On Values Of A String Of Bits

Apr 1, 2014

I have a problem I am working on where I need to sort some data based on the values of a string of bits. The strings look like this,

010000001110000000

there are 18 bits, 1 means a feature is present, 0 means the feature is absent.

Each of these string has 4 on bits. I need to sort them such that I have the longest possible runs with 3 of the same on bits. It doesn't matter which 3 bits are on, I am just looking to order them in blocks with the longest possible runs. As a second step, the ordered blocks will be sorted by size large>small.

The following data is ordered like I need it to be.

Code:
// block 1, run of 12, keys 1,2,11 are identical (key 12 is also identical)
011000000001100000
011000000001100000
011000000001100000
011000000001100000

[Code] .....

This is the sort order that I am looking for. I need to be able to take a list of the bit strings in any particular order and sort them into the order above. The algorithm would need to recognize that there are 4 on keys and then look for groupings of three common on keys.

This is more of an algorithm question than one about specific implementation in code. I generally assume that most programming problems have been solved one way or another, so I don't know much about analyzing and manipulating strings of bits.

Is there a standard method for this kind of pattern recognition?

View 14 Replies View Related

C++ :: Create Matrix Of Data That Add Values Based On Reading Get From DVM

Apr 22, 2012

Ok I'm trying to create matrix of data that I can add values to based on a reading that I will get from a DVM. I'm using a 3d vector to do this. I need to keep track of the serial number, the day and within day I need to take two readings at different temps, this will continue for 7 days.

The rows of my 3d vector will be the days, the colums will be the serial numbers the depth will be the reading at the different temps.

What I need to do is compare the first element (days) and when it is greater then or equal to 4 I will perform calculations of the readings. So all I want to do is compare the first element of the vector, How do I do this?

Here is what I got

Code:
#include <vector>
typedef std::vector<double> Double1D;
typedef std::vector<Double1D> Double2D;
typedef std::vector<Double2D> Double3D;
#define HEIGHT 5
#define WIDTH 3

[Code]....

View 7 Replies View Related

C++ :: Sorting Data Based On Some Metric - Function Pointer Syntax

Nov 20, 2014

I have a piece of code that sorts data based on some metric. The some metric is something I now want to make flexible so I can easily switch between and compare metrics. To do this, I want to pass the function to use as a parameter to the method that does the sorting (and other stuff). However, I'm having problems figuring out the syntax. Also, I think my [temporary] organization of code is violating a lot of basic code design principles.

To make the function pointer passable, I defined the "typename" in the header where the function is located (it is part of a struct, "Data"):

// Below the struct definition of Data
typedef double (Data::*CostF)(unsigned l, double W) const;

The two example functions I want to use are defined in that struct ("Data"):

// Inside the struct definition
inline double someExampleCost(unsigned l, double W) const {
// Returns some basic calculation
}

The function that uses it is part of a different class (that holds a reference to the first class, in case that matters; I feel like I'm doing something odd here, because I'm binding a member function in the definition/passing, but never referencing the object). It looks like this:

// Inside another class ("Foo")
inline void DoSomeStuff(double& ECost, double& TCost, CostF cost) {
// Irrelevant stuff here
std::sort(vector.begin(), vector.end(), [&](unsigned a, unsigned b){
return (*cost)(a, W) < (*cost)(b, W);
});
// More irrelevant stuff here
}

The error shown is "operand of "*" must be a pointer". If I remove the '*':
[code]return cost(A, W) < cost(b, W);

the error becomes: "expression must have a (pointer-to-)function type."

The call to this function is, currently, just in the main function, as I'm just testing before I wrap it into real code. It looks like this:

// In main
Foo bar; // Make an object of the struct that has the "sorting" function
CostF costFunction = &Data::someExampleCost;
// Bind to the Cost function bar.DoSomeStuff(varA, varB, costFunction);

This bit shows no errors by itself. So, my questions:

a) Clearly I'm missing the insight into Function Pointers. I'm comfortable with regular pointer stuff, but I can't wrap my head around FPs, partly due to the awkward syntax.

b) I'm very uncomfortable with the fact that I'm binding a member function of a class, but never try to reference an actual object of that class. This is probably a big part of why it's not working, but I can't seem to bind a function belonging to a specific object. I thought of doing

// In the main again
Data d; // Construct the object, which contains big lookup tables
Foo F(d); // Construct the object, which only holds a reference to a Data object
CostF costFunction = &d.someExampleCost; // Bind to the Cost function of that object

but that doesn't work ("a pointer to a bound function may only be used to call the function").

View 4 Replies View Related







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