Passing parameter to a function in C#
I have a small program. It includes a listbox and few textboxes. There are
few elements in the listbox and depending on the selected index it outputs
the corresponding values into the textboxes.
Code example: http://notepad.cc/share/AGh5zLNjfJ
I want to use a function to print the values into the textboxes instead of
typing them over and over again in switch cases.
Something like this:
switch(personList.SelectedIndex)
{
case 0:
output(person1);
break;
case 1;
output(person2);
break;
}
I couldn't pass the person object and access its properties with the
function I created. SOS.
No comments:
Post a Comment