473,387 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Communicating between classes

Hi,

I am having a problem communicating between to classes.
I have an MDI application. The parent window contains a
mainMenu and a toolbar and toolbuttons, and the child
form contains a richTextBox.

What I am trying to do is to when a the selected text in
the richTextBox is bullet indented, a menu option on the
parent window is toggled on or off depending on what is
selected in the richTextBox.

The problem I am having is changing the checked property
of the menuItem. when I make the menuItem "public static"
all seems to work except that after running the
application, the menuItem dissapears in Visual C# design
view. Then dissapears when I next run the application.
The code is still there, but the control doesn't appear
on the form. Obviously I am doing something wrong, if
only I could figure out what it is!

I would appreciate any assistance.
Nov 15 '05 #1
2 1420
Hi Matthew,

Usually, modifying the designer generated code by hand, can cause
the winforms designer to get confused, and that's probably why the menu item
disappears in the designer view when you changed the menuitem to
a static member.

You can possibly try to pass a reference to your parent window
when you create an instance of the child window.
The child window can stash away the reference to the parent
window, and then call an appropriate method in the parent window
that causes the menuitem to be updated when the text in the RichTextBox
is selected. Alternatively, you can pass a reference to the menuitem alone
to the child window.

Regards,
Aravind C
"Matthew Playne" <an*******@discussions.microsoft.com> wrote in message
news:03****************************@phx.gbl...
Hi,

I am having a problem communicating between to classes.
I have an MDI application. The parent window contains a
mainMenu and a toolbar and toolbuttons, and the child
form contains a richTextBox.

What I am trying to do is to when a the selected text in
the richTextBox is bullet indented, a menu option on the
parent window is toggled on or off depending on what is
selected in the richTextBox.

The problem I am having is changing the checked property
of the menuItem. when I make the menuItem "public static"
all seems to work except that after running the
application, the menuItem dissapears in Visual C# design
view. Then dissapears when I next run the application.
The code is still there, but the control doesn't appear
on the form. Obviously I am doing something wrong, if
only I could figure out what it is!

I would appreciate any assistance.

Nov 15 '05 #2
Thanks Aravind,

That explaination sorted it out for me.
Now it actually works!

Matthew
-----Original Message-----
Hi Matthew,

Usually, modifying the designer generated code by hand, can causethe winforms designer to get confused, and that's probably why the menu itemdisappears in the designer view when you changed the menuitem toa static member.

You can possibly try to pass a reference to your parent windowwhen you create an instance of the child window.
The child window can stash away the reference to the parentwindow, and then call an appropriate method in the parent windowthat causes the menuitem to be updated when the text in the RichTextBoxis selected. Alternatively, you can pass a reference to the menuitem aloneto the child window.

Regards,
Aravind C
"Matthew Playne" <an*******@discussions.microsoft.com> wrote in messagenews:03****************************@phx.gbl...
Hi,

I am having a problem communicating between to classes.
I have an MDI application. The parent window contains a
mainMenu and a toolbar and toolbuttons, and the child
form contains a richTextBox.

What I am trying to do is to when a the selected text in the richTextBox is bullet indented, a menu option on the parent window is toggled on or off depending on what is
selected in the richTextBox.

The problem I am having is changing the checked property of the menuItem. when I make the menuItem "public static" all seems to work except that after running the
application, the menuItem dissapears in Visual C# design view. Then dissapears when I next run the application.
The code is still there, but the control doesn't appear
on the form. Obviously I am doing something wrong, if
only I could figure out what it is!

I would appreciate any assistance.

.

Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Nimit | last post by:
Hi, I wasn't sure which forum this post belongs to, so I've posted it to a couple forums that I thought may be appropriate. In giving me advice, please consider me a beginner. Below is a synopsis...
3
by: Stan | last post by:
Hallo, I have developed an application in MS Access 2000 (Polish version) under MS Windows XP prof (also Polish). Now I would like to run this code on MS Windows XP EN and MS Access XP EN. I have...
1
by: TGF | last post by:
Hello, I have a little dilemma (At least it is to me). I have two classes, Class A and class B, where Class A contains the UI thread and class B contains another thread. I want to be able to...
2
by: Wendy Elizabeth | last post by:
I am new to using .net. I am told that I need to setup a config file that will be accessed by a VB.net dll. This vb.net dll will be setup to run every 5 to 10 minutes by a timer that is coded into...
2
by: Paul Bromley | last post by:
Hi, Can someone point me in the right direcion here. I have been a hobbyist programmer for some time with VB6 and am moving to Vb.Net. I am afraid that in the past I did not uderstand too well...
4
by: Greg | last post by:
I've been tasked with writing a small app to that needs to talk to a remote server via raw http. Data is to be sent and received using name-value pairs. I have been given the syntax for various...
2
by: Veleek | last post by:
An alternate title for this might be "Creating my own set of core classes". Just a quick overview. In order to learn C#, Sockets, Multithreading and whatever else I can, I am attempting to...
2
by: Chris | last post by:
Hi, I seem to be having some problems connecting to webservices. I'm running a C# client connected to a Java webservice using GLUE. The difference between the two request and response pairs...
1
by: David Veeneman | last post by:
This posting is for the Google crawler and requires no response. I have created a multi-level object hierarchy, in which the root object needs to be notified whenever any property of any object...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
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,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.