Prepare for your Next Interview
|
Welcome to the Geeks Talk forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us. |
This is a discussion on Get out put without taking argument within the C# forums, part of the Software Development category; Doubt in a program using static methods and static classes In the below program in the static method I am taking a argument string s. Without taking a argument, how ...
|
|||||||
|
|||
|
Get out put without taking argument
Doubt in a program using static methods and static classes
In the below program in the static method I am taking a argument string s. Without taking a argument, how can I get the same output ie “hi”, but I should use static methods and static classes. // In general declaration static class test { public static void show(String s) { MessageBox.Show(s); } } private void button1_Click(object sender, EventArgs e) { test.show("HI"); // test t = new test(); } |
| Sponsored Links |
|
|||
|
Re: Get out put without taking argument
// In general declaration
static class test { public static s as string; // Declare static variable . so that u can use in any one class by using (test.s) public static void show() { MessageBox.Show(s); } } private void button1_Click(object sender, EventArgs e) { s="HI"; // put the data into static variable s . If ur using in the same class then u can use s directlry. Other wise u have to use s after class name(eg. test.s="HI" } |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Taking Backup of daily task in companies | amaravadi.krishna81 | ASP.NET | 2 | 01-21-2008 02:27 PM |
| argument promotions | pbchaudhari | C and C++ | 0 | 09-10-2007 08:44 AM |
| About Argument in C++ | Robert | C and C++ | 6 | 02-16-2007 05:04 AM |
| Taking much time to open form in project instance.. | JobHelper | Oracle Apps | 0 | 02-08-2007 02:43 PM |
| Important Qualities required for taking an Online Education | Lokesh M | Online Degree Programs | 0 | 06-24-2006 12:04 PM |