Geeks Talk

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.

Get out put without taking argument

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 ...

Go Back   Geeks Talk > Software Development > C#
Register Blogs FAQ Tag Cloud Calendar Mark Forums Read
  #1 (permalink)  
Old 11-22-2007
Junior Member
 
Join Date: Aug 2007
Posts: 19
Thanks: 1
Thanked 5 Times in 5 Posts
aarruunnaa is on a distinguished road
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();
}
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 12-29-2007
Junior Member
 
Join Date: Dec 2007
Location: Jamshedpur
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Sanatan Kumar is on a distinguished road
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"
}
Reply With Quote
Reply

  Geeks Talk > Software Development > C#

Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


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


All times are GMT -4. The time now is 09:28 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.1
Copyright © 2009 GeekInterview.com. All Rights Reserved