Click here to Skip to main content
15,893,814 members
Home / Discussions / C#
   

C#

 
QuestionHow to print two languages in the same line? Pin
moh_monir23-Sep-05 22:13
moh_monir23-Sep-05 22:13 
Questionget the calling function and class name Pin
Anonymous23-Sep-05 20:26
Anonymous23-Sep-05 20:26 
AnswerRe: get the calling function and class name Pin
Nick Parker24-Sep-05 9:45
protectorNick Parker24-Sep-05 9:45 
QuestionRegular expression help me Pin
rockxuyenmandem23-Sep-05 19:07
rockxuyenmandem23-Sep-05 19:07 
AnswerRe: Regular expression help me Pin
Alex Korchemniy23-Sep-05 20:00
Alex Korchemniy23-Sep-05 20:00 
AnswerRe: Regular expression help me Pin
Guffa23-Sep-05 21:12
Guffa23-Sep-05 21:12 
AnswerRe: Regular expression help me Pin
Daniel Grunwald23-Sep-05 22:44
Daniel Grunwald23-Sep-05 22:44 
Questionrun a application at a specified time Pin
dhol23-Sep-05 17:39
dhol23-Sep-05 17:39 
AnswerRe: run a application at a specified time Pin
Dave Kreskowiak24-Sep-05 15:59
mveDave Kreskowiak24-Sep-05 15:59 
Questionhow to use mouse on focus events Pin
jyothi_pradeep_satyam_corp23-Sep-05 17:38
jyothi_pradeep_satyam_corp23-Sep-05 17:38 
AnswerRe: how to use mouse on focus events Pin
enjoycrack23-Sep-05 18:30
enjoycrack23-Sep-05 18:30 
QuestionOwner-Drawn TabControl Pin
Darryl Borden23-Sep-05 17:36
Darryl Borden23-Sep-05 17:36 
AnswerRe: Owner-Drawn TabControl Pin
Darryl Borden26-Sep-05 3:06
Darryl Borden26-Sep-05 3:06 
Questioncalender help Pin
visiontec23-Sep-05 17:22
visiontec23-Sep-05 17:22 
AnswerRe: calender help Pin
Alex Korchemniy23-Sep-05 19:51
Alex Korchemniy23-Sep-05 19:51 
AnswerRe: calender help Pin
mav.northwind23-Sep-05 21:25
mav.northwind23-Sep-05 21:25 
Questionupdate from dataset to database Pin
cauvang23-Sep-05 17:01
cauvang23-Sep-05 17:01 
AnswerRe: update from dataset to database Pin
Alex Korchemniy23-Sep-05 19:48
Alex Korchemniy23-Sep-05 19:48 
GeneralRe: update from dataset to database Pin
cauvang24-Sep-05 14:35
cauvang24-Sep-05 14:35 
Questiondatabase Pin
Tran Ngoc Minh23-Sep-05 16:54
Tran Ngoc Minh23-Sep-05 16:54 
AnswerRe: database Pin
enjoycrack23-Sep-05 18:24
enjoycrack23-Sep-05 18:24 
QuestionHow to reach an object that dont have name Pin
mego_z2023-Sep-05 15:53
mego_z2023-Sep-05 15:53 
AnswerRe: How to reach an object that dont have name Pin
Wjousts23-Sep-05 16:03
Wjousts23-Sep-05 16:03 
You need to store a reference to the object somewhere. An ArrayList is a good choice:

<br />
ArrayList Men;<br />
.<br />
.<br />
.<br />
private void button1_Click(object sender,System.EventArgs e)<br />
{<br />
man m = new man;<br />
m.Name = textbox1.Text;<br />
m.length = int.parse(textbox2.text);<br />
Men.Add(m);<br />
}<br />


You can then access the objects through the ArrayList, for example to find the man with a name stored in a string:

<br />
private man Find(string key)<br />
{<br />
foreach (man m in Men)<br />
{<br />
if (m.Name == key)<br />
{<br />
return m;<br />
}<br />
}<br />
return null;        // didn't find it<br />
}<br />


There are more efficient ways to do it and different collection you can use depending on exactly what you want and how much coding you want to do up front. For example, you could create your own collection which keeps the names in order so you can search them more efficiently.
AnswerRe: How to reach an object that dont have name Pin
Mohamad Al Husseiny23-Sep-05 16:41
Mohamad Al Husseiny23-Sep-05 16:41 
AnswerRe: How to reach an object that dont have name Pin
mego_z2024-Sep-05 5:21
mego_z2024-Sep-05 5:21 

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.