Click here to Skip to main content
15,905,325 members
Home / Discussions / C#
   

C#

 
GeneralRe: struct question Pin
Tom Larsen13-Jul-04 5:34
Tom Larsen13-Jul-04 5:34 
GeneralRe: struct question Pin
Heath Stewart13-Jul-04 6:11
protectorHeath Stewart13-Jul-04 6:11 
GeneralAccessing Forms Pin
Mehbub13-Jul-04 5:02
Mehbub13-Jul-04 5:02 
GeneralRe: Accessing Forms Pin
Tom Larsen13-Jul-04 5:27
Tom Larsen13-Jul-04 5:27 
GeneralRe: Accessing Forms Pin
Colin Angus Mackay13-Jul-04 6:03
Colin Angus Mackay13-Jul-04 6:03 
GeneralRe: Accessing Forms Pin
Dave Kreskowiak13-Jul-04 12:46
mveDave Kreskowiak13-Jul-04 12:46 
GeneralRe: Accessing Forms Pin
Weiye Chen13-Jul-04 19:36
Weiye Chen13-Jul-04 19:36 
GeneralRe: Accessing Forms Pin
Weiye Chen13-Jul-04 20:52
Weiye Chen13-Jul-04 20:52 
Ok, i have received your code. Let me paste some of it here so that the rest of the developers can give their advice too.

FormA.cs
private void Form1_Load(object sender, System.EventArgs e)
{
  Form frmB = new FormB();
  frmB.MdiParent = this;
  frmB.Show();			
}
 
FormB.cs
private void btnAccessFormA_Click(object sender, System.EventArgs e)
{
   //I have created a method called "test". I can't access that method either. And 
   // it got public access.
   Form frmA = new FormA();					
   //This bit of code doesn't work. Cause the object(frmA) i created is referin to null.
// frmA.button1.Visible = true;
// frmA.button2.Visible = true;
// frmA.button3.Visible = true;
// frmA.button4.Visible = true;
// frmA.button5.Visible = true;
// frmA.button6.Visible = true;
}

Mehbub wrote:
How can i access those buttons from formB.

You can't access the same form A's buttons in form B by creating Form A again. Since FormA is your mdi parent and FormB is the child, you can use the MdiParent property of FormB. e.g.
FormB.cs
private void btnAccessFormA_Click(object sender, System.EventArgs e)
{
   // Get your parent form, which is FormA in this case and access your
   // button since you have set it as public.
   this.MdiParent.button1.Visible = true;
}
I'm not sure if you need to cast it to FormA first like :
((FormA)this.MdiParent).button1.Visible = true;
I don't have VS.NET on my pc here to test it out.

<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
GeneralViewing Exported Functions and Parameters in a DLL Pin
Mr. Rogers13-Jul-04 4:22
Mr. Rogers13-Jul-04 4:22 
GeneralRe: Viewing Exported Functions and Parameters in a DLL Pin
Heath Stewart13-Jul-04 4:33
protectorHeath Stewart13-Jul-04 4:33 
GeneralRe: Viewing Exported Functions and Parameters in a DLL Pin
Mr. Rogers13-Jul-04 4:51
Mr. Rogers13-Jul-04 4:51 
QuestionHow to get the time from a computer Pin
Stuggo13-Jul-04 4:11
Stuggo13-Jul-04 4:11 
AnswerRe: How to get the time from a computer Pin
Heath Stewart13-Jul-04 4:20
protectorHeath Stewart13-Jul-04 4:20 
GeneralResponse.Redirect is not working.. a peculiar problem..One solution found !! Pin
PhaniKatakam13-Jul-04 2:07
PhaniKatakam13-Jul-04 2:07 
GeneralRe: Response.Redirect is not working.. a peculiar problem..One solution found !! Pin
Heath Stewart13-Jul-04 4:13
protectorHeath Stewart13-Jul-04 4:13 
GeneralAccessing HTML control Pin
Padmavathi13-Jul-04 1:26
Padmavathi13-Jul-04 1:26 
GeneralRe: Accessing HTML control Pin
Heath Stewart13-Jul-04 4:07
protectorHeath Stewart13-Jul-04 4:07 
GeneralProblem when Distributing A C#.Net Application Pin
Axonn Echysttas13-Jul-04 1:23
Axonn Echysttas13-Jul-04 1:23 
GeneralRe: Problem when Distributing A C#.Net Application Pin
Heath Stewart13-Jul-04 3:56
protectorHeath Stewart13-Jul-04 3:56 
GeneralRe: Problem when Distributing A C#.Net Application Pin
Axonn Echysttas13-Jul-04 5:19
Axonn Echysttas13-Jul-04 5:19 
GeneralRe: Problem when Distributing A C#.Net Application Pin
Heath Stewart13-Jul-04 5:24
protectorHeath Stewart13-Jul-04 5:24 
GeneralRe: Problem when Distributing A C#.Net Application Pin
Axonn Echysttas13-Jul-04 5:49
Axonn Echysttas13-Jul-04 5:49 
GeneralRe: Problem when Distributing A C#.Net Application Pin
Heath Stewart13-Jul-04 6:09
protectorHeath Stewart13-Jul-04 6:09 
GeneralRe: Problem when Distributing A C#.Net Application Pin
Axonn Ech.13-Jul-04 10:50
sussAxonn Ech.13-Jul-04 10:50 
Generalhowto to implement SOAP in C# Pin
Stephan Wright13-Jul-04 0:47
Stephan Wright13-Jul-04 0:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.