Click here to Skip to main content
15,916,692 members
Home / Discussions / C#
   

C#

 
Questionhow to open and edit DICOM images and c# Pin
durukan2-Apr-04 22:45
durukan2-Apr-04 22:45 
AnswerRe: how to open and edit DICOM images and c# Pin
chrixian2-Apr-04 23:25
chrixian2-Apr-04 23:25 
AnswerRe: how to open and edit DICOM images and c# Pin
Dave Kreskowiak3-Apr-04 2:16
mveDave Kreskowiak3-Apr-04 2:16 
QuestionHow to Get Keyboard Control Pin
Member 6910892-Apr-04 19:44
Member 6910892-Apr-04 19:44 
AnswerRe: How to Get Keyboard Control Pin
Heath Stewart3-Apr-04 3:28
protectorHeath Stewart3-Apr-04 3:28 
GeneralBlock Size & Key Size - Crypto Algorithm Pin
Danial Cox2-Apr-04 19:04
Danial Cox2-Apr-04 19:04 
GeneralRe: Block Size & Key Size - Crypto Algorithm Pin
Heath Stewart3-Apr-04 3:24
protectorHeath Stewart3-Apr-04 3:24 
GeneralBuilding a reference to a control with a string Pin
mironos2-Apr-04 14:34
mironos2-Apr-04 14:34 
Hello,

I'm pretty new to C#, so forgive me if this is an overly simple question.

I'm trying to write an event handler that can be used for multiple different controls. Each time the event is fired, I need to make changes to several different controls at once.

My controls are named as such:
avail0Add
avail0
daily0 ...

avail1Add
avail1
daily1 ... and so on


The way I've been trying to do this (which hasn't worked) is by building the reference to the control using a substring of the name of the sender (namely the "0" or the "1" in the name. So conceptually, I want to do something like this:

private void availAdd_Click(object sender, System.EventArgs e)
{
string i = ((Button)sender).Name.ToString().Substring(5,1);
foreach(Person person in ("avail" + i).SelectedItems)
{
("daily" + i).Items.Add(person);
}
}

I don't know if there is syntax for this is C# that I just don't know, or if this isn't possible. I know the equivalent in VB would look something like:

Me.Controls("daily" & i).[rest of the code]

I would prefer it to do it this way if possible, but am open to other solutions as well.

thanks,
Eric.
GeneralRe: Building a reference to a control with a string Pin
Dave Kreskowiak2-Apr-04 15:40
mveDave Kreskowiak2-Apr-04 15:40 
Generalrouter simulator code Pin
mbdcisco2-Apr-04 14:08
mbdcisco2-Apr-04 14:08 
GeneralRe: router simulator code Pin
leppie2-Apr-04 20:17
leppie2-Apr-04 20:17 
GeneralDataSet not getting updated Pin
MeterMan2-Apr-04 12:22
MeterMan2-Apr-04 12:22 
GeneralRe: DataSet not getting updated Pin
Charlie Williams2-Apr-04 12:50
Charlie Williams2-Apr-04 12:50 
GeneralRe: DataSet not getting updated Pin
MeterMan2-Apr-04 14:18
MeterMan2-Apr-04 14:18 
GeneralRe: DataSet not getting updated Pin
LongRange.Shooter5-Apr-04 3:42
LongRange.Shooter5-Apr-04 3:42 
GeneralPartial String Searches in C# Pin
Vodstok2-Apr-04 9:14
Vodstok2-Apr-04 9:14 
GeneralRe: Partial String Searches in C# Pin
Heath Stewart2-Apr-04 9:24
protectorHeath Stewart2-Apr-04 9:24 
GeneralRe: Partial String Searches in C# Pin
Vodstok5-Apr-04 5:31
Vodstok5-Apr-04 5:31 
GeneralRe: Partial String Searches in C# Pin
Heath Stewart5-Apr-04 5:53
protectorHeath Stewart5-Apr-04 5:53 
GeneralRe: Partial String Searches in C# Pin
Vodstok5-Apr-04 6:04
Vodstok5-Apr-04 6:04 
QuestionHow can I hide a TabPage? Pin
Andretux2-Apr-04 8:51
Andretux2-Apr-04 8:51 
AnswerRe: How can I hide a TabPage? Pin
Heath Stewart2-Apr-04 9:10
protectorHeath Stewart2-Apr-04 9:10 
Generalresx bug(?) Pin
Hugo Hallman2-Apr-04 8:01
Hugo Hallman2-Apr-04 8:01 
GeneralRe: resx bug(?) Pin
Hugo Hallman2-Apr-04 8:25
Hugo Hallman2-Apr-04 8:25 
GeneralRe: resx bug(?) Pin
Heath Stewart2-Apr-04 9:13
protectorHeath Stewart2-Apr-04 9:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.