RSS Forums RSS
Please support our C# advertiser: Programming Forums
Views: 3086 | Replies: 4
Reply
Join Date: Nov 2006
Posts: 49
Reputation: kobi is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
kobi kobi is offline Offline
Light Poster

Question passing array into a function

  #1  
Jul 26th, 2007
Hello there,
I have an array of 2 dimensional which i need to pass to a funtion,
but every time i try to send to the funcation "LoadScenario" it fails.

maybe my syntax is wrong,please take a look

Thanks Ahead

string[,] Vars = newstring[5,4];
 
 
Vars[0,1]="Calculos";
Vars[1,1]=" 1";
Vars[2,1]=" 2";
Vars[3,1]=" 3";
 
Vars[0,0]="General";
Vars[1,0]=" 4";
Vars[2,0]=" 5";
Vars[3,0]=" 5";
Vars[4,0]=" 6";
 
LoadScenario(Vars);
 
------------------------
privatevoid LoadScenario(string Vars1)
{
//do something
}
 
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2007
Posts: 3
Reputation: vinod varma is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
vinod varma vinod varma is offline Offline
Newbie Poster

Re: passing array into a function

  #2  
Jul 26th, 2007
string[,] Vars = newstring[5,4];


Vars[1,0]="Calculos";
Vars[1,1]=" 1";
Vars[1,2]=" 2";
Vars[1,3]=" 3";

Vars[0,0]="General";
Vars[0,1]=" 4";
Vars[0,2]=" 5";
Vars[0,3]=" 5";
Vars[0,4]=" 6";

LoadScenario(Vars);
try this
Reply With Quote  
Join Date: Nov 2006
Posts: 49
Reputation: kobi is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
kobi kobi is offline Offline
Light Poster

Re: passing array into a function

  #3  
Jul 26th, 2007
where is the differance?
Thanks
Reply With Quote  
Join Date: Apr 2004
Location: Tracy
Posts: 744
Reputation: Killer_Typo will become famous soon enough Killer_Typo will become famous soon enough 
Rep Power: 7
Solved Threads: 32
Killer_Typo's Avatar
Killer_Typo Killer_Typo is offline Offline
Master Poster

Re: passing array into a function

  #4  
Jul 27th, 2007
he probably left off his method declaration

  1.  
  2. private void LoadScenario( string[,] Vars ) {
  3. }
  4.  
  5. //but if you only need one portion of the string in vars
  6.  
  7. private void LoadScenario(string Vars) {}
  8.  
  9. //then call like this..
  10. //assume we are inside of a class at this point
  11.  
  12. LoadScenario(vars[x,y]);
  13.  
  14. //where x is some int within bounds
  15. //where y is some int within bounds
  16.  
!!!!! WARNING YOUR COMPUTER MAY BE INFECTED WITH SPYWARE!!!! PAY AN OVER PRICED AMMOUNT TO HAVE SOMTHING FIXED WE PLACED THERE IN THE FIRST PLACE!!!!!!!!!

sound familiar, know how to block yourself and keep yourself clean.
_____________________
http://www.lavasoftusa.com/ -->adaware
http://www.safer-networking.org/en/index.html -->spybot S&D
http://www.javacoolsoftware.com/spywareblaster.html -->spywareblaster
http://www.javacoolsoftware.com/spywareguard.html -->spywareguard
_____________________
and dont forget to spread the reputation to those that deserve!
Reply With Quote  
Join Date: Nov 2006
Posts: 49
Reputation: kobi is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
kobi kobi is offline Offline
Light Poster

Re: passing array into a function

  #5  
Jul 27th, 2007
Thanks
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 6:38 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC