|
Hi Stuart Dootson
This things is working fine.But i need to use "Select * from Tablename".Show how can i get full information of table in
_variant_t.
Plz help me
|
|
|
|
|
It's not too difficult to find[^] appropriate examples[^] on t'Internet.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I am working on VC++ project where I am using VSFlexGrid.
I need to copy a string from any editor (e.g notepad, MS Word etc) and after validating for certain
conditions, paste the string in FlexGrid cell, if validations conditions are true.
I have tried using KeyPessEdit event for ctrl+v (ASCII == 22)
I tried something like this :
if(*KeyAscii == 22)
{
// Paste the string in FlexGrid cell
char* tempString= NULL ;
string buffer = NULL ;
bool bIsValidChar = true;
tempString = (char*)GetClipboardData(CF_TEXT);
for(int i = 0; '\0' != tempString[i]; i++ )
{
if( (tempString[i] >= 65 && tempString[i] <= 70 ) || tempString[i] >= 48 && tempString[i] <= 57))
{
continue;
}
else
{ bIsValidChar = false;
break;
}
}
But in this case before control reaches to 'bool bIsValidChar = true;' string copied from elsewhere gets pasted in FlexGrid cell. That means by default implementation of Paste method of FlexGrid is getting called.
So how can I do my validations and then allow or disallow the pasting of string in a cell.
How can I handle FlexGrid's OnPaste event ?
|
|
|
|
|
Hope you may find the answer from this forum[^].
|
|
|
|
|
check events provided by flexgrid control!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I have names of certain students and their ages stored in a text file
'records.txt'.
LIKE:
John 22
Paul 21
Sam 24
Harry 23
Now i want to store these ages and names in a structure 'records(r)' directly from the file. (Here i am not taking any input from the user)
as r.name & r.age.
Any clue to the solution???
|
|
|
|
|
I believe this query was answered
|
|
|
|
|
I couldn't get that. Plesae elaborate the clue so that i can learn a bit more.
I am trying to use the "isdigit" command for this purpose. Would that be suitable?
|
|
|
|
|
Dear Razanust,
I'll first suggess you not to create a new thread if you aren't satisfied with the answer.
Razanust wrote: couldn't get that. Plesae elaborate the clue so that i can learn a bit more.
I am trying to use the "isdigit" command for this purpose. Would that be suitable?
Now, as your file is a text file, First Clear whether you have stored it by formating by sprintf and then WriteFile etc or Writing the structure directly?
HARSH
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning.
modified on Tuesday, June 30, 2009 3:59 AM
|
|
|
|
|
Razanust wrote: Any clue to the solution???
1. Read the file line by line
2. use something like strtok to tokenize each line
3. fill the structure
|
|
|
|
|
I Don't know why u are trying there tipical methods.
Just Try the "C" way: -
struct MyStruct
{
char Name[20];
int age;
}
MyStruct myStruct;
FILE *pFile = fopen("Record.txt", "Wb+");
fwrite((char*)&myStruct, sizeof(MyStruct), 1, pFile);
and to reead :-
fread((char*)&myStruct, sizeof(MyStruct), 1, pFile);
HARSH
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning.
|
|
|
|
|
Harsh Shankar wrote: I Don't know why u are trying there tipical methods.
What?
|
|
|
|
|
Wouldn't it be easier to read and write the data in the file by my given way??
HARSH
Programmers are in a race with the Universe to create bigger and better idiot-proof programs, while the Universe is trying to create bigger and better idiots. So far the Universe is winning.
modified on Tuesday, June 30, 2009 5:25 AM
|
|
|
|
|
I don't see anything in his post about writing the data back to a file. He only wants to read the file and store the tokens in a structure (or presumably an array of structures).
|
|
|
|
|
You need to open the file, read the contents, parse the read contents, store them into an array of structures.
Which part of this exercise are you having a problem with? And what have you done so far?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
supposing your use C language.may be this is a simply.You could use fscanf() function to realize it.You may find out the method of "fscanf()".
Like C++ more
|
|
|
|
|
Razanust wrote: Any clue to the solution???
Well, something like this comes to mind:
std::ifstream fin;
std::vector<Record> records;
fin.open("c:\\Records.txt");
std::copy(std::istream_iterator<Record>(fin), std::istream_iterator<Record>(), std::back_inserter(records));
fin.close(); Hint: you'll need to create the Record class.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi, how to set an image as a background for dialog box or form in vc++?
Thanks in advance..
|
|
|
|
|
|
I wonder why your posting was down voted.
I have compensated it.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
void CClass::OnPaint()
{
CPaintDC dc(this); // device context for painting
CPaintDC dcc(this);
CRect rect;
GetClientRect(&rect);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
CBitmap bmpBackground;
bmpBackground.LoadBitmap(IDB_BITMAP1);
//IDB_BITMAP1 is the image ID
BITMAP bitmap;
bmpBackground.GetBitmap(&bitmap);
CBitmap *pbmpOld=dcMem.SelectObject(&bmpBackground);
dc.StretchBlt(0,0,rect.Width(),rect.Height(),&dcMem,0,0,
bitmap.bmWidth,bitmap.bmHeight,SRCCOPY);
}
|
|
|
|
|
Hi,
I am wondering if anyone can help me out, i have created the following class and when i include it in another class it compiles fine, but when i try to create an object of it i get the following error:
1>Stocks.obj : error LNK2019: unresolved external symbol "public: __thiscall CStringParser::CStringParser(void)" (??0CStringParser@@QAE@XZ) referenced in function "public: __thiscall Stocks::Stocks(void)" (??0Stocks@@QAE@XZ)
1>Stocks.obj : error LNK2019: unresolved external symbol "public: __thiscall CStringParser::~CStringParser(void)" (??1CStringParser@@QAE@XZ) referenced in function "public: __thiscall Stocks::~Stocks(void)" (??1Stocks@@QAE@XZ)
In the file im calling this from i include the StringParser.h but still get this unresolved external symbol. Previously i have been including the .cpp files and it worked, but I want to learn how to do it properly using only header files. I am using Visual Studio 2008
Thanks in advance
#pragma once
#include <string>
#include <vector>
class CStringParser
{
public:
CStringParser::CStringParser();
CStringParser::~CStringParser();
std::vector<CString> CStringParser::ParseString(CString s, CString c);
};
#pragma once
#include "StringParser.h"
#include <string>
#include <vector>
CStringParser::CStringParser()
{
}
CStringParser::~CStringParser()
{
}
std::vector<CString> CStringParser::ParseString(CString s, CString c )
{
............
}
#pragma once
#include "StringParser.h"
class Test
{
public:
Test(void);
~Test(void);
private:
CStringParser sp;
};
|
|
|
|
|
Have you added StringParser.cpp to your project?
|
|
|
|
|
Member 4705538 wrote: Previously i have been including the .cpp files and it worked, but I want to learn how to do it properly using only header files.
What do you mean by previously include .cpp files?
Do you mean #include or include in the project?
You're most likely not including StringParser.cpp as part of the project.
If you don't, this file will not be compiled into an obj file.
The linker, when creating the executable will search for the functions(symbols) in the obj files.
And since StringParser.obj hasn't been created, it cannot find the constructor and destructor function definitions and so the errors.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Thanks for the replies, and yes i haven't included the cpp file into my project, do i just simply include it into any of my files that use the CStringParser or shall i include it in settings or stdafx.h?
|
|
|
|