473,785 Members | 2,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to send data to controls which is in MDI Parent



Hi,

I am facing problem with, sending data frm mdi child to
mdi parent.

I have search Dropdown in MDI form, depend on selection,
or enter string(its like IE URL functionality) and click
search button, i am displaying Details form with all the
details. Their i have Delete button. When we click on
delete button, we have to delete the record from database
and at the same time, i have to delete record from the
drop down.

Here i have one private array list, every time depend on
search i am modifying array list and binding it to the
drop down.

I have changed drop down Modifiers to public and tried to
access from the child form. Its not accessing the
control. Any one will send how to solove this problem.

Waiting for replaies.....

Regards
Satish
Nov 15 '05 #1
3 4447
You probably didn't do a proper type-cast. If you have the control public
you should be able to access it.

Some other possible solutions:

1. Have an event on the Child form and register the parent as a listener to
the "Delete" button event.
2. Add a static method on the MDI parent's class that does the job for you
(on the currently active MDI form)

-vJ

"Satish" <ds*********@ho tmail.com> wrote in message
news:07******** *************** *****@phx.gbl.. .


Hi,

I am facing problem with, sending data frm mdi child to
mdi parent.

I have search Dropdown in MDI form, depend on selection,
or enter string(its like IE URL functionality) and click
search button, i am displaying Details form with all the
details. Their i have Delete button. When we click on
delete button, we have to delete the record from database
and at the same time, i have to delete record from the
drop down.

Here i have one private array list, every time depend on
search i am modifying array list and binding it to the
drop down.

I have changed drop down Modifiers to public and tried to
access from the child form. Its not accessing the
control. Any one will send how to solove this problem.

Waiting for replaies.....

Regards
Satish

Nov 15 '05 #2


I have written static method in MDI and tried to access
from teh chaild form. like

//this is in Child form Delete event
MDIform frm=null;
frm.Delete_Cont actName();
this.Close();

this is in MDI form
public static void Delete_ContactN ame()
{
try
{
//array list
alContacts.Remo ve(cmbContact.T ext.Trim());
cmbContact.Text ="";
bContactFill=fa lse;
cmbContact.Data Source=null;
cmbContact.Data Source=alContac ts;
//cmbContact.Sele ctedIndex=0;
bContactFill=tr ue;
}
catch{}
finally{}
}

while compiling the source its giving error that
MDIform.cmbCont act denotes a 'field' where a class was
expected

-----Original Message-----
You probably didn't do a proper type-cast. If you have the control publicyou should be able to access it.

Some other possible solutions:

1. Have an event on the Child form and register the parent as a listener tothe "Delete" button event.
2. Add a static method on the MDI parent's class that does the job for you(on the currently active MDI form)

-vJ

"Satish" <ds*********@ho tmail.com> wrote in message
news:07******* *************** ******@phx.gbl. ..


Hi,

I am facing problem with, sending data frm mdi child to
mdi parent.

I have search Dropdown in MDI form, depend on selection, or enter string(its like IE URL functionality) and click search button, i am displaying Details form with all the details. Their i have Delete button. When we click on
delete button, we have to delete the record from database and at the same time, i have to delete record from the
drop down.

Here i have one private array list, every time depend on search i am modifying array list and binding it to the
drop down.

I have changed drop down Modifiers to public and tried to access from the child form. Its not accessing the
control. Any one will send how to solove this problem.

Waiting for replaies.....

Regards
Satish

.

Nov 15 '05 #3
You can work around it if you know there's going to be only one MDIform per
process.

Create a new static variable in the MDIform of type MDIform and in the
constructor of MDIform, set the current instance to this variable... like
this..

public class MDIform : Form
{
...
...
private static MDIform mainForm;

/// Constructor
public MDIForm()
{
...
...
mainForm = this;
}
}

And in your static function Delete_ContactN ame(), use the mainForm to access
the members... like mainForm.cmbCon tact.Text = "";

Ok... all this aside, I think using static members for this is a bad design.
You should look into using Events and delegates. Set up an event that gets
triggered when the Delete button is clicked and listen for it from the
MainForm.

Good Luck
-vJ

"Satish" <ds*********@ho tmail.com> wrote in message
news:07******** *************** *****@phx.gbl.. .


I have written static method in MDI and tried to access
from teh chaild form. like

//this is in Child form Delete event
MDIform frm=null;
frm.Delete_Cont actName();
this.Close();

this is in MDI form
public static void Delete_ContactN ame()
{
try
{
//array list
alContacts.Remo ve(cmbContact.T ext.Trim());
cmbContact.Text ="";
bContactFill=fa lse;
cmbContact.Data Source=null;
cmbContact.Data Source=alContac ts;
//cmbContact.Sele ctedIndex=0;
bContactFill=tr ue;
}
catch{}
finally{}
}

while compiling the source its giving error that
MDIform.cmbCont act denotes a 'field' where a class was
expected

-----Original Message-----
You probably didn't do a proper type-cast. If you have

the control public
you should be able to access it.

Some other possible solutions:

1. Have an event on the Child form and register the

parent as a listener to
the "Delete" button event.
2. Add a static method on the MDI parent's class that

does the job for you
(on the currently active MDI form)

-vJ

"Satish" <ds*********@ho tmail.com> wrote in message
news:07******* *************** ******@phx.gbl. ..


Hi,

I am facing problem with, sending data frm mdi child to
mdi parent.

I have search Dropdown in MDI form, depend on selection, or enter string(its like IE URL functionality) and click search button, i am displaying Details form with all the details. Their i have Delete button. When we click on
delete button, we have to delete the record from database and at the same time, i have to delete record from the
drop down.

Here i have one private array list, every time depend on search i am modifying array list and binding it to the
drop down.

I have changed drop down Modifiers to public and tried to access from the child form. Its not accessing the
control. Any one will send how to solove this problem.

Waiting for replaies.....

Regards
Satish

.

Nov 15 '05 #4

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

Similar topics

1
1772
by: Satish | last post by:
Hi, I am facing problem with, sending data frm mdi child to mdi parent. I have search Dropdown in MDI form, depend on selection, or enter string(its like IE URL functionality) and click search button, i am displaying Details form with all the details. Their i have Delete button. When we click on delete button, we have to delete the record from database and at the same time, i have to delete record from the drop down.
1
1230
by: epigram | last post by:
I'd like to know if there is a best approach, in terms of using the Data Web Controls (i.e. DataGrid, DataList & Repeater), for displaying data that is the result of a query that joins two tables that have a one-to-many relationship. For instance if I perform a query on two such tables, I might expect that there would be data repeated on multiple rows from table on the one side of the relationship. What I want to do is display an HTML...
5
6454
by: sutphinwb | last post by:
Hi - This could be a simple question. When I relate two tables in a datasetet, how do I get that relation to show up in a GridView? The only way I've done it, is to create a separate table in the dataset with a join query for the GetData() select method. I use ObjectDataStore to couple the GridView with the table adapter on the dataset. If I point the ODS at the child table, the GridView will bind to the "normal" select and I end up...
0
1186
by: ja | last post by:
To explain: I want to send HTML email from windows.forms app. I need to have textual templates which could be used for changing email bodies. Is it possible to use ASP.NET controls to achieve this? Something like: 1) read textual content from a file to a string (text being mixture of HTML and ASP.NET tags). For example parent ASP.NET panel control with number of other ASP.NET controls within.
14
14659
by: Rolf Welskes | last post by:
Hello, I have an ObjectDataSource which has as business-object a simple array of strings. No problem. I have an own (custom) control to which I give the DataSourceId and in the custom-control so I get the ObjectDataSource. No problem ..... ObjectDataSource src = .... //is ok i have it
0
1289
by: forumaic | last post by:
Hello, I am trying to export data to excel from datagrid, and I am getting an error: "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)." Error details: System.Web.HttpException was unhandled by user code Message="The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)."
1
2656
by: forumaic | last post by:
Hello, I am trying to export data to excel from datagrid, and I am getting an error: "The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>)." Error details: System.Web.HttpException was unhandled by user code Message="The Controls collection cannot be modified because the control
1
3568
by: Bob Johnson | last post by:
..NET 3.5, Windows Forms app: My objective is to display parent/child data in two ComboBox controls, such that when a parent item is selected in one combo box, associated child items appear in the other combo box. I already know one way to make this work using two DataTables and a DataView, and handling the SelectionChangeCommitted event of the parent ComboBox so that it sets the .RowFilter of the DataView to which the child ComboBox is...
3
3010
by: balurajeev | last post by:
Hii, currently i am working on an apliction(ASP.NET/C#) that creates dynamic html rows which contain six html text boxes and a html dropdowllist. At the time of page load the web page contain six server side text boxes and a serverside drop down list. and a html "Addrow" buton which create client side textboxes and dropdown list dynamichally Now i am meeting a problem of passing values from dynamichally created html controls to Server Side...
0
9480
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10093
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,...
0
8976
agi2029
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...
1
7500
isladogs
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...
0
6740
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5381
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4053
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3654
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.