473,386 Members | 1,796 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,386 software developers and data experts.

String Variable

Dear All,

Ok, In Visual Foxpro if i write this code :

Local mApp AS String
mApp = "DO Report.App"

If I Write &mApp it has the same mean with Do Report.App, how can i do
this in C# ?

Thank You

Nov 15 '05 #1
5 3162
Yudi,
Ok, In Visual Foxpro if i write this code :

Local mApp AS String
mApp = "DO Report.App"

If I Write &mApp it has the same mean with Do Report.App, how can i do
this in C# ?


Here is one way to do it:

// declare the delegate to return a string assuming that
// Do Report.App returns a string.
public delegate string ReportAppDelegate( );

....

// Create the delegate that will be used to execute the code.
ReportAppDelegate myApp = new ReportAppDelegate( Report.App );

.....

// execute the code -- you could also pass the delegate
// around before you execute the code.
myApp( );

Another way to accomplish this is through reflection. Hope that helps.

Regards,

Randy

Nov 15 '05 #2
It's not clear what you are trying to do.
Please be more descriptive.

"Yudi Tristianto" <yu**@widatra.com> wrote in message
news:3F**************@widatra.com...
Dear All,

Ok, In Visual Foxpro if i write this code :

Local mApp AS String
mApp = "DO Report.App"

If I Write &mApp it has the same mean with Do Report.App, how can i do
this in C# ?

Thank You

Nov 15 '05 #3
Dear All,

Other Example :
i have form ini C# project call the project name is HRD which the name
form is password, in C# if i want call that form i have write this code:

HRD.password frm = new HRD.password();
frm.Show();

The Question , Can I Call that form with this code :

String mForm = "password"
HRD.mForm frm = new HRD.mForm();
frm.Show();

Thanks U

codewriter wrote:
It's not clear what you are trying to do.
Please be more descriptive.

"Yudi Tristianto" <yu**@widatra.com> wrote in message
news:3F**************@widatra.com...
Dear All,

Ok, In Visual Foxpro if i write this code :

Local mApp AS String
mApp = "DO Report.App"

If I Write &mApp it has the same mean with Do Report.App, how can i do
this in C# ?

Thank You



Nov 15 '05 #4
So, How Can I Do This In C# ?

codewriter wrote:
No.
It won't work this way.

"Yudi Tristianto" <yu**@widatra.com> wrote in message
news:3F**************@widatra.com...
Dear All,

Other Example :
i have form ini C# project call the project name is HRD which the name
form is password, in C# if i want call that form i have write this code:

HRD.password frm = new HRD.password();
frm.Show();

The Question , Can I Call that form with this code :

String mForm = "password"
HRD.mForm frm = new HRD.mForm();
frm.Show();

Thanks U

codewriter wrote:
It's not clear what you are trying to do.
Please be more descriptive.

"Yudi Tristianto" <yu**@widatra.com> wrote in message
news:3F**************@widatra.com...
Dear All,

Ok, In Visual Foxpro if i write this code :

Local mApp AS String
mApp = "DO Report.App"

If I Write &mApp it has the same mean with Do Report.App, how can i do
this in C# ?

Thank You



Nov 15 '05 #5
Take a look at the Activator class. It let's you instantiate objects given a
class name. If all your forms derive from a common base class (probably the
Form class), you may define your variable as that type. Something like:

Form myForm;
myForm = (Form)Activator.CreateInstance("myassembly",
"mynamspace.password").Unwrap();
myForm.Show();
Arild

"Yudi Tristianto" <yu**@widatra.com> wrote in message
news:3F**************@widatra.com...
So, How Can I Do This In C# ?

codewriter wrote:
No.
It won't work this way.

"Yudi Tristianto" <yu**@widatra.com> wrote in message
news:3F**************@widatra.com...
Dear All,

Other Example :
i have form ini C# project call the project name is HRD which the name
form is password, in C# if i want call that form i have write this code:

HRD.password frm = new HRD.password();
frm.Show();

The Question , Can I Call that form with this code :

String mForm = "password"
HRD.mForm frm = new HRD.mForm();
frm.Show();

Thanks U

codewriter wrote:

It's not clear what you are trying to do.
Please be more descriptive.

"Yudi Tristianto" <yu**@widatra.com> wrote in message
news:3F**************@widatra.com...
>Dear All,
>
>Ok, In Visual Foxpro if i write this code :
>
>Local mApp AS String
>mApp = "DO Report.App"
>
>If I Write &mApp it has the same mean with Do Report.App, how can i do
>this in C# ?
>
>Thank You
>


Nov 15 '05 #6

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

Similar topics

16
by: PK9 | last post by:
I have a string variable that holds the equivalent of a DateTime value. I pulled this datetime from the database and I want to strip off the time portion before displaying to the user. I am...
7
by: al | last post by:
char s = "This string literal"; or char *s= "This string literal"; Both define a string literal. Both suppose to be read-only and not to be modified according to Standard. And both have...
23
by: Nascimento | last post by:
Hello, How to I do to return a string as a result of a function. I wrote the following function: char prt_tralha(int num) { int i; char tralha;
4
by: JohnR | last post by:
Hi all, I'm finally sick and tired of manually generating get/set properties for each private variable in a class so I'm trying to create a macro to do it. I'm stuck because I can't figure out...
2
by: HerbD | last post by:
I have a loooong debugging session behind me! I finally found the reason for the problem and now would like to know, if it is a bug in my code or not standardconformant behavour of the compiler(s) or...
21
by: phpCodeHead | last post by:
Code which should allow my constructor to accept arguments: <?php class Person { function __construct($name) { $this->name = $name; } function getName()
5
by: cameljs18 | last post by:
Converting a string variable into a string literal. How do I add the @ character in front of the string? I cannot add it when the string is created as it will affect other parts of the program. ...
3
by: Hvid Hat | last post by:
Hi I want to highlight (make it bold) a word in some text I'm getting in XML format. My plan was to replace the word with a bold (or span) tag with the word within the tag. I've found the code...
4
by: mthread | last post by:
Hi, I am using a string variable in which I do lot of appending. The only difficulty I am facing as of now is appending a integer/float value to this variable. Although I can accomplish this task...
2
by: Looch | last post by:
All, I'm trying to output but I can only get (brackets for clarity) when using the code below. How can I "break" into the query variable in the InsertName method to add the name parameter to...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
jinu1996
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...

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.