Lost Password?

Go Back   CodeCall Programming Forum > Software Development > C# Programming

C# Programming C# (pronounced C-sharp) is a new object oriented language from Microsoft and is derived from C and C++. It also borrows a lot of concepts from Java too including garbage collection.

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-04-2008, 04:04 PM
gaylo565's Avatar   
gaylo565 gaylo565 is offline
Learning Programmer
 
Join Date: May 2007
Location: flagstaff, az
Posts: 65
Last Blog:
String Manipulation wi...
Rep Power: 6
gaylo565 will become famous soon enoughgaylo565 will become famous soon enough
Default Using array index

I have a question using a button array. I wanted to access a corresponding pic box while im looping through my button array...Is there a way to store the index to a variable to pass into the next method?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Sponsored Links
  #2 (permalink)  
Old 05-08-2008, 03:19 PM
Xav's Avatar   
Xav Xav is offline
Guru
 
Join Date: Mar 2008
Location: London, England
Posts: 2,969
Last Blog:
Piano Exam
Rep Power: 25
Xav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to all
Send a message via MSN to Xav
Default Re: Using array index

Set up the method with a parameter:

Code:
private void MyMethod(int index)
{
  MessageBox.Show("The index is " + index.ToString());
}
As you can see, you can then access the variable within the method. To use the method:

Code:
MyMethod(6);
- this uses the index 6 to pass to the method.
__________________
Xav, the power of youth
Worship the Creator... not his creations
Web Site | Beta Site
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-15-2008, 07:32 PM
textte textte is offline
Newbie
 
Join Date: May 2008
Posts: 2
Rep Power: 0
textte is on a distinguished road
Default Re: Using array index

or you can associate "commandtext" property with the index
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 05-16-2008, 11:19 AM
Xav's Avatar   
Xav Xav is offline
Guru
 
Join Date: Mar 2008
Location: London, England
Posts: 2,969
Last Blog:
Piano Exam
Rep Power: 25
Xav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to allXav is a name known to all
Send a message via MSN to Xav
Default Re: Using array index

Yes, but that's not a very good way to do it. My way is a better way to pass parameters across the methods.
__________________
Xav, the power of youth
Worship the Creator... not his creations
Web Site | Beta Site
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
filling an array with random #s gaylo565 C# Programming 5 05-02-2008 11:21 AM
I need array help. thieflock Java Help 1 04-14-2008 10:02 PM
[ C++ ] Drawing Program. Max_Payne C and C++ 6 01-23-2008 09:18 PM
Usage of array structures to increment letter instances of text Yuriy M C and C++ 2 09-13-2007 10:49 AM
Python 2D array question annannienann Delphi/Python 3 04-23-2007 04:36 PM


All times are GMT -5. The time now is 10:59 PM.

Contest Stats

John ........ 87.50000
dargueta ........ 75.00000
Xav ........ 50.00000
MeTh0Dz ........ 20.00000
gaylo565 ........ 18.00000
Johnnyboy ........ 3.00000

Contest Rules

Ads