HighTechTalks DotNet Forums  

ref parameter

Dotnet VJSharp microsoft.public.dotnet.vjsharp


Discuss ref parameter in the Dotnet VJSharp forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Burton Wilkins
 
Posts: n/a

Default ref parameter - 10-20-2004 , 10:33 PM






Dear Authorities:

In C# and in other languages there is support for "ref" parameter. I need
to be able to accomplish the same in J#. Does anyone know how this could
be accomplished? Please advise.

What I want to accomplish is to pass the equivalent of reference to a
"Label". The Label should be a parameter in a Class method parameter,
such that when I change the Text value of the Label passed as a reference
with the Class method, the Label's text value will also be changed outside
the class.

Sincerely,

Burt



Reply With Quote
  #2  
Old   
Burton Wilkins
 
Posts: n/a

Default Re: ref parameter - 10-24-2004 , 10:41 PM






Dear Lars-Inge:

Thank you for your patience. You are a great help to the J# community.

I could find no documentation that suggested this to work. So I assumed
that there was
some missing syntax that I needed to accomplish this. Had I just had the
unknown,
which you so simply suggested, I would have discovered that it works without
any
additional syntax.

Thank you Lars. You have helped me once before concerning J#, and now you
have done it again.

"Lars-Inge Tønnessen [VJ# MVP]" <http://emailme.larsinge.com> wrote in
message news:%23JgCZ$cuEHA.1452 (AT) TK2MSFTNGP11 (DOT) phx.gbl...
Quote:
Anything like this?


import System.Drawing.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;
import System.Data.*;

public class label_change
{

public label_change()
{
}

public void changeText( System.Windows.Forms.Label lab )
{
lab.set_Text("Hello from me");
}
}


public class Form1 extends System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.ComponentModel.Container components = null;

public Form1()
{
InitializeComponent();

label_change a = new label_change();
a.changeText( this.label1 );
}

protected void Dispose(boolean disposing)
{
if (disposing)
{
if (components != null)
{
components.Dispose();
}
}
super.Dispose(disposing);
}

#region Windows Form Designer generated code
/**
* Required method for Designer support - do not modify
* the contents of this method with the code editor.
*/
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.set_Location(new System.Drawing.Point(56, 40));
this.label1.set_Name("label1");
this.label1.set_TabIndex(0);
this.label1.set_Text("label1");
//
// Form1
//
this.set_AutoScaleBaseSize(new System.Drawing.Size(5, 13));
this.set_ClientSize(new System.Drawing.Size(292, 266));
this.get_Controls().AddRange(new System.Windows.Forms.Control[]
{
this.label1}
);
this.set_Name("Form1");
this.set_Text("Form1");
this.ResumeLayout(false);

}
#endregion

/** @attribute System.STAThread() */
public static void main(String[] args)
{
Application.Run(new Form1());
}
}


Regards,
Lars-Inge Tønnessen





Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.