Solved

C++ Builder Problem

Posted on 2000-04-19
6
193 Views
Last Modified: 2010-04-10
Hi there,
I have a major problem with something I am working on.  I just can not seem to get it working.  I am trying to reference a TRichEdit Control from a program which I added into my Project.
I am trying to read in each line from the TRichEdit control and Copy it into a temp buffer.
The name of the Richedit control is: Editor and the form it is on is EditForm(This is an MDIChild Form).

Any help would be much appreciated -Cheers
Elmo
0
Comment
Question by:Elmo_
  • 3
  • 2
6 Comments
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2731015
You can use Lines Property. Next is code:
....
   char buff[121];
   int n = RichEdit1->Lines->Count;
   for (int i = 0; i < n; i++)
     {
       AnsiString ptr = RichEdit1->Lines->Strings[i];
       strcpy(buff, ptr.c_str());
     }
.....

I hope, it helps. Alex
0
 
LVL 3

Author Comment

by:Elmo_
ID: 2731102
Alex,
      I am still getting the same problem.  I get an Error Number 93
"Undefined Symbol 'Editor'.
      Editor is the Label for the Richedit Control which is located on an MDI Child form
called EditForm
      I have tried includeing the header files of the forms so that it might identify
the control but there is still nothing happening.
      Any Ideas...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#include <iostream.h>
#include <conio.h>
#include <vcl.h>
#include "MDIFrame.h"
#include "MDIEdit.h"
#pragma hdrstop


    int Line_Count;
    char Line_Buffer[132];      //Reads in a temp strin - The line
    int Char_Count;

    Line_Count = 0;

    int n = Editor->Lines->Count;

    for (int i = 0; i < n; i++)
        {
        AnsiString ptr = Editor->Lines->Strings[i];
        strcpy(Line_Buffer, ptr.c_str());
        Line_Count++;
        Char_Count = 0;
        Inspect_Line(&Char_Count, Line_Buffer, &Line_Count);
        }

Thanks alot for your Time,
      Elmo_
0
 
LVL 3

Author Comment

by:Elmo_
ID: 2731106
Alex,
      I am still getting the same problem.  I get an Error Number 93
"Undefined Symbol 'Editor'.
      Editor is the Label for the Richedit Control which is located on an MDI Child form
called EditForm
      I have tried includeing the header files of the forms so that it might identify
the control but there is still nothing happening.
      Any Ideas...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#include <iostream.h>
#include <conio.h>
#include <vcl.h>
#include "MDIFrame.h"
#include "MDIEdit.h"
#pragma hdrstop


    int Line_Count;
    char Line_Buffer[132];      //Reads in a temp strin - The line
    int Char_Count;

    Line_Count = 0;

    int n = Editor->Lines->Count;

    for (int i = 0; i < n; i++)
        {
        AnsiString ptr = Editor->Lines->Strings[i];
        strcpy(Line_Buffer, ptr.c_str());
        Line_Count++;
        Char_Count = 0;
        Inspect_Line(&Char_Count, Line_Buffer, &Line_Count);
        }

Thanks alot for your Time,
      Elmo_
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 3

Author Comment

by:Elmo_
ID: 2731341
Alex,
I am still getting the same problem.  I get an Error Number 93
"Undefined Symbol 'Editor'.
Editor is the Label for the Richedit Control which is located on an MDI Child form
called EditForm
I have tried includeing the header files of the forms so that it might identify
the control but there is still nothing happening.
Any Ideas...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#include <iostream.h>
#include <conio.h>
#include <vcl.h>
#include "MDIFrame.h"
#include "MDIEdit.h"
#pragma hdrstop


    int Line_Count;
    char Line_Buffer[132]; //Reads in a temp strin - The line
    int Char_Count;

    Line_Count = 0;

    int n = Editor->Lines->Count;

    for (int i = 0; i < n; i++)
        {
        AnsiString ptr = Editor->Lines->Strings[i];
        strcpy(Line_Buffer, ptr.c_str());
        Line_Count++;
        Char_Count = 0;
        Inspect_Line(&Char_Count, Line_Buffer, &Line_Count);
        }

Thanks alot for your Time,
Elmo_
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 50 total points
ID: 2731570
You must simple add in you h/cpp file:
extern *TRichEdit Editor;
(if  Editor is name of you RichEdit
Control)
0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 2732165
You ALMOST have it... note the refrence to EditForm->Editor...



Good luck!!


#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <fstream.h>
#include <iostream.h>
#include <conio.h>
#include <vcl.h>
#include "MDIFrame.h"
#include "MDIEdit.h"
#pragma hdrstop


    int Line_Count;
    char Line_Buffer[132]; //Reads in a temp strin - The line
    int Char_Count;

    Line_Count = 0;

    int n = EditForm->Editor->Lines->Count;

    for (int i = 0; i < n; i++)
        {
        AnsiString ptr = EditForm->Editor->Lines->Strings[i];
        strcpy(Line_Buffer, ptr.c_str());
        Line_Count++;
        Char_Count = 0;
        Inspect_Line(&Char_Count, Line_Buffer, &Line_Count);
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Quicksort a dynamic deque 33 66
computer science syllabus 3 70
I could not build boost code, 10 78
C++ error cannot convert from std::string to const char * 6 130
Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
This article will show you some of the more useful Standard Template Library (STL) algorithms through the use of working examples.  You will learn about how these algorithms fit into the STL architecture, how they work with STL containers, and why t…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now