hi,
i am creating a word processor in c# and would like to know 2 things:
1. in my separate find form, how do i acess a richtextbox in my main form
(form1)?
2. i know the code to find stuff e.g.
richtextbox1.fi nd(searchtermsb ox.text);
but if you click the find button with this code at its onclick event, it
will only find the first time the text appears. what code do i need for a
button that finds all of the recurrances of the text e.g. a find next button?
--
Alvo von Cossel I of Germany 4 2144
Alvo von Cossel I wrote: hi,
i am creating a word processor in c# and would like to know 2 things:
1. in my separate find form, how do i acess a richtextbox in my main form (form1)?
2. i know the code to find stuff e.g.
richtextbox1.fi nd(searchtermsb ox.text);
There are several overloads of find. One uses the text only, one takes
an integer as the second argument, which is the position to start
searching from.
int pos = 0;
for ( int i=0; i<3; ++i )
pos = richtextbox1.fi nd( searchtermsbox. text, pos+1 );
for example, will find the 3rd occurrence.
Matt
hi,
thanks for the answer. by the way, would you happen to know the answer to my
first question: in my separate find form, how do i acess a richtextbox in my
main form (form1)?
--
Alvo von Cossel I of Germany
Not unlike the source viewer you were making for your web browser, your best
bet would be to expose a property from the form containing the RichTextBox
that is accessible via the reference to the containing form from the calling
code.
Brendan
"Alvo von Cossel I" wrote: hi,
thanks for the answer. by the way, would you happen to know the answer to my first question: in my separate find form, how do i acess a richtextbox in my main form (form1)? -- Alvo von Cossel I of Germany
Alvo von Cossel I wrote: hi,
thanks for the answer. by the way, would you happen to know the answer to my first question: in my separate find form, how do i acess a richtextbox in my main form (form1)?
You have two choices.
1) Make the richtextbox a public variable in form1:
public class Form1
{
public RichTextBox richtextbox1; // Change from private.
}
2) Make it a property of the form:
public class Form1
{
private RichTextBox richtextbox1;
public RichTextBox RichText // Or whatever you want to call it.
{
get { return richtextbox1; }
}
}
Then just use it from another form:
public class Form2 : Form
{
void function()
{
// Case 1: public variable
Form1.richtext1 .<whatever>
// Case 2: property
Form1.RichText. <whatever>
}
}
Matt
}
}
-- Alvo von Cossel I of Germany This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: GS |
last post by:
I am doing my first real embedded programming project and the supplied
device libraries have a function definition that looks like this:
void FCN(void) = { INTDEF, INTABS, (unsigned short) PTRDEF};
where
INTDEF = some #defined integer
INTABS = some absolute integer (e.g. 2)
PTRDEF = some #defined pointer
|
by: anonymous |
last post by:
Thanks your reply.
The article I read is from
www.hakin9.org/en/attachments/stackoverflow_en.pdf.
And you're right. I don't know it very clearly. And that's why I want
to understand it; for it's useful to help me to solve some basic
problem which I may not perceive before.
I appreciate your help,
sincerely.
|
by: priyanka |
last post by:
Hi,
I was wondering if we could parse or do something in the executable(
whose source language was C). How can I use some scripting language
like perl/python to find out the information about the executable ? Is
it possible ?
Also, how does the compiler add inling to the program ? I know that
whenever it sees"inline" in front of the procedure name, it inlines it.
But if we give the -finline options, it inline all the procedures ? How
|
by: Ian Mackenzie |
last post by:
Hi Guys
I am VERY new to DB2 and have created a workingdays function to return
the working days between 2 dates, but I get some compiler errors when
running it:
CREATE FUNCTION WORKINGDAYS (STARTDATE, ENDDATE DATE) RETURNS INTEGER
DETERMINISTIC NO EXTERNAL ACTION
BEGIN ATOMIC
DECLARE DAYCOUNT INTEGER
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |