class Excuse
{...
public string Description { get; set; }
public string Results { get; set; }
public DateTime LastUsed { get; set; }
public string ExcusePath { get; set; }
....}
[Code] ...
When I run it, I do get the messagebox popping up with the correct description, but then nothing happens. When I debug, I see the fields under the UpdateForm() method are set to null.
I'm guessing this happening because it is looking at the 'currentExcuse' that was declared in the form body. I thought however that redeclaring 'currentExcuse' in the method would overwrite this instance or am I wrong?
I have a method to take a Tile object and make an instances of it based on some data from the original object. Than it is suppose to manipulate the a specific instance and save the results. The first loop through it works but it changes all instance as well as the base.
public static int recurse(int count, Tile[,] b,Huristic h,int check) { if (check==1) { boardState.Add(B)/>; return check; } if (check == 0)
I am using the above code to retrive an item selected by user,But this line is giving an exception "Null Reference Exception, Object reference not set to an instance of an object"
I need to use an instance of an object in a header file. The object requires a lot of pre-computation to be created.
I want to assign it to a "static const *NAMEobject*" field in the .h file, once it has been created. I assume that it is better to create it in another file and somehow pass it into the .h file.
I need a static hash table to keep track of all objects of a particular type that are instantiated in a Qt application but I have never used a template class as a static member object before and I can't seem to figure out how to initialize it. QHash is the hash table class that follows the template convetion:
template<class key, class data>
QString is probably self explanatory.
Example Header:
class MyClass { ... private: static QHash<QString, MyClass*> instanceTable; }
Here is my source that doesn't compile.
Example Source
#include header.h // using default constructor for table... QHash<QString key, MyClass* instance> MyClass::instanceTable(); // gives Error below. // Error in above line is "Declaration is incompatible with QHash<QString, Myclass*>"
I have tried doing it a number of different ways and none of them work. How do you initialize a static template object?
public class ColorGenetics { public static hk1Class jw; public static linkedClass link; }
[code]...
Code builds fine but compiler says I tried to use bject link w/o providing an instance. Class linkedClass has an instance of Class hk1Class set to var jw1.I had linkedClass useing the same var jw for the object instance. I changed it to jw1 thinking that would clear it up and it didn't.
I need to send same instance of object of a class in two function (Main function and thread function). The class is something like this:
//The class need to have constructor. Class ABC { public: DWORD *IdG; ABC(int number) { IdG = new DWORD[number]; } }obj(32);
The obj(32) is called in following two function. Function F1 is called using thread in main function.
void F1() { obj.test; } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) { obj.test1; _beginthread(F1,0,(void*)number); }
The code works well when the object of class ABC is created as shown above. My problem is the value that is passed in the object ('32') is to be read from the file.
If I read the file and create object separately in Main function and function 'F1' then , function 'F1' is not executed.
How to create same instance of object for Main function and function 'F1' with value passed in the object taken from the file.
Are the objects in both vectors the same instance of the object? Like if I called vectorOne[0].setValue(somethingDifferent); would the value be changed for the object in both vectorOne and vectorTwo? If not, how do I make sure that I only have one instance of the object I'm trying to store in multiple vectors?
I'm trying to make a "Rain" application, by drawing some lines on the form, and then they must fall. So here is my start code:
public partial class Form1 : Form { public Form1() { InitializeComponent(); } Random r = new Random(); Graphics paper; Line line;
[Code] ....
So when I start debugging I get the "Object reference not set to an instance of an object." error. If I remove the comments lines at "timer1_Tick" this error doesn't appear of course. What can I do to escape from this because it follows me everywhere I go />. I tried to make with arrays, but same problem.
I have a variable named Authors. Sometimes I will insert one author into the database, sometimes more than one author will be inserted into the database.
The page that performs the update is a .cs page. Here is the layout:
using System; using System.Collections.Generic; using System.Configuration; using System.Data.SqlClient;
[Code]....
This definitely works for updating one author's name:
if (old.Author != Author) RequestItem.UpdateField(LibraryDocID, Editor, "Author", Author);
I just can not nail down how to insert a string of author's names.
I am so close to finishing this program. It will find the median of an array of 5 values. I have one last error that I cannot seem to get to go away. Here's the code:
#include <algorithm> #include <functional> #include <array> #include <iostream> using namespace std; int main() { int integer1, integer2, integer3, integer4, integer5;
[Code] .....
The error states: "IntelliSense: no instance of overloaded function "std::nth_element" matches the argument list, argument types are: (std::_Array_iterator, std::_Array_iterator, unsigned int, std::_Array_iterator)
class DataBase { // Change the connection path here to your own version of the database public SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)v11.0;AttachDbFilename=|DataDirectory|UberDatabase.mdf;Integrated Security=True;"); public DataBase() { } }
And in the same namespace as this class I have a form that calls it like so:
DataBase dBase = new DataBase(); SqlCommand trythis = new SqlCommand("Register", dBase.con);
However, I'm getting the field initializer error on dBase.con. I'm not sure why, but when I call the database from another file (program.cs) it works fine this way.
Write a constructor that initializes a new inventory object with the values passed as arguments, but which also includes a reasonable default value for each parameter.
#include <iostream> #include "curve1.h" #include "curve2.h" using namespace std; int main() { Curve1 curve1Obj; Curve2 curve2Obj;
[Code]...
Base class Score has two derived classes Curve1 and Curve2. There are two curve() functions, one is in Curve1 and other in Curve2 classes. getSize() returns the value of iSize.
My base class header score.h looks like this:
#ifndef SCORE_H #define SCORE_H class Score { private: int *ipScore; float fAverage; int iSize;
[Code]...
You can see that I have used curve1Obj to enter scores, calculate average and output. So if I call getSize() function with cuve1Obj, it gives the right size that I took from user in enterScores() function. Also the result is same if I call getSize() in score.cpp definition file in any of the functions (obviously). .....
The problem is when I call curve() function of Curve2 class in main (line 23) with the object curve2Obj, it creates a new set of ipScore, fAverage and iSize (i think?) with garbage values. So when I call getSize() in curve() definition in curve2.cpp, it outputs the garbage. .....
How can I cause it to return the old values that are set in curve1.cpp?
Here is my curve2.cpp
#include <iostream> #include "curve2.h" using namespace std; void Curve2::curve() { cout << "getSize() returns: " << getSize() << endl; // out comes the garbage }
Can I use a function to simply put values from old to new variables? If yes then how?
I'm trying to write a simple program that extract the FAT information from a FAT32 virtual Hard Disk.I have the following structures regarding the FAT format:
Code:
//BOOT RECORD typedef struct NF_BOOT_RECORD { unsigned char BS_jumpBoot[3]; //EB 58 90 = JUMP 58 NOP (Jumps to boot code). Also E9 is acceptable. unsigned char BS_OEMName[8]; //Either MSWIN4.1 or mkdosfs unsigned short BS_BytesPerSec; //Little endian. The size of a sector. 128,256,512,1024... unsigned char BS_SecPerClus; //The number of sectors per cluster (1 CLUSTER = BPS*SPC BYTES) unsigned short BS_RsvdSecCnt; //The boot sectors (this) are included. That makes at least 1. }
[code]...
Everything seems to work fine. Mostly. The only problem, is that the program gives me the following output:BS_NumFATs shouldn't be 0. In fact, I've checked inside the structure memory, and the information seems correct. BS_NumFATs is 0x02, not 0x00 (It's the byte at offset 0x10, starting at 0x00).
I've checked the order of the structure fields, and their types, comparing them to the FAT specification given by Microsoft (File fatgen103.pdf), and it seems fine, unless I'm missing something. So I don't know why it gives 0 instead of 2, if I'm missing something.It's a Win32 program compiled with GCC version 4.4.0
I wrote a script that generates n random pixel positions and draws them to the screen. Works well. Now i tried to rotate them. Rotating does work too. But it does not work as i planned it.
paramters 'angle' and 'timestep' work somehow, but not as they should do. the function 'move' is supposed to rotate the pixelfield 'angle' degrees in a given direction, addicted to the 'timestep' parameter. 'timestep' is needed time for drawing in one single game loop.
rotation point is the middle of the screen. when i set angle to 10 it should rotate 10 degrees / second. Instead it's rotating very very fast and all stars are moving nearer to the center of the screen, so after x rounds there is just 1 pixel left in the middle of the screen. there is a kind of gravition.I'm working with SDL2. What I did find out:
FPS is <= 60, 'cause of the 'SDL_RENDERER_PRESENTVSYNC' flag. When i skip that flag, for any reason the 'gravition' would take more time. FPS is <= 1400 then, 'though i got a natural game loop (i hope):
I need writing a program in c++ that will get the input of 50 different users for the following the fields (surname, other names, sex, status, date of birth) and after entering the data for these 50 users, it will then output only the list of all FEMALE users who were registered...
#include <iostream> #include <string> using namespace std; int main () { string surname, other_names1, other_names2, status, sex, dob;
[Code] ....
I don't really know what to do next - all my attempts have not really given me the result I want.
is there way that I go like: cout << c1; not overloading << operator; and it shows me a value of c1.x? just wanna replace c1 with that value; I need sth similar to indexer from c#.