نقل قول: جستجو در ArrayList
سلام
نقل قول:
... در TextBoxهایی نمایش بدم
نمی دونم دارید چه کار می کنید ولی فکر می کنم بهتره از listbox یا listview استفاده کنید.
نقل قول:
حالا باید چیکار کنم؟؟؟
نمی دونم سر کدوم قسمتش مشکل دارید. لطفا مسئله رو بازتر کنید.
نقل قول: جستجو در ArrayList
اولاً که چون یک کلاسه بهتره که از List<T> استفاده کنید.
خیر.
باید از FindFirst استفاده کنید.
و یه predicate بهش بدید.
نقل قول: جستجو در ArrayList
نقل قول:
نوشته شده توسط
cardano7
سلام
نمی دونم دارید چه کار می کنید ولی فکر می کنم بهتره از listbox یا listview استفاده کنید.
نمی دونم سر کدوم قسمتش مشکل دارید. لطفا مسئله رو بازتر کنید.
نه حتما باید تو TextBox نمایش داده بشه .مشکلم تو پیدا کردن اون آیتم های بعدی و نمایش اونا تو TextBoxهاست.
نقل قول: جستجو در ArrayList
MyClass c = null;
try
{
c = myArrayList.Cast<MyClass>().First(n => n.MyProperty == 10);
}catch{}
if (c != null)
{
for (int i = myArrayList.IndexOf(c); i < myArrayList.Count; i++)
{
//get a[i]
}
}
نقل قول: جستجو در ArrayList
ببین مرضیه برای راحتی کار از یه foreach استفاده کن و بعد توش شرطو بنویس و بعد هم
textbox1.text+=class.obj; موفق باشی
نقل قول: جستجو در ArrayList
نقل قول:
نوشته شده توسط
parva-88
ببین مرضیه برای راحتی کار از یه foreach استفاده کن و بعد توش شرطو بنویس و بعد هم
textbox1.text+=class.obj; موفق باشی
پروا جان بیشتر توضیح بده متوجه نمیشم.
نقل قول: جستجو در ArrayList
نقل قول:
نوشته شده توسط
Marzieh-H
سلام دوستان
من Arraylist ای دارم که آبجکتهایی از یه کلاسی که خودم ساختم دارم حالا میخوام یه آیتم مشخصی رو تو این Arraylist پیدا کنم که البته میدونم باید از Contains استفاده کنم و بعد در ضورت وجود چنین آیتمی، دیگر آیتمهای این Arraylist رو در TextBoxهایی نمایش بدم حالا باید چیکار کنم؟؟؟
اگه منظورتون رو متوجه شده باشم اعضای لیست رو میخوایید بجز آیتم مورد نظر. برای اینکار کد زیر رو امتحان کنید :
var tmp=arrrayList.cast<yourClass>();
var query=tmp.where(i=>i!=object);
در این کد منظور از object آیتمی هست که شما نمی خواهید در لیست تون باشه
نقل قول: جستجو در ArrayList
نقل قول:
نوشته شده توسط
moharrami
اگه منظورتون رو متوجه شده باشم اعضای لیست رو میخوایید بجز آیتم مورد نظر. برای اینکار کد زیر رو امتحان کنید :
var tmp=arrrayList.cast<yourClass>();
var query=tmp.where(i=>i!=object);
در این کد منظور از object آیتمی هست که شما نمی خواهید در لیست تون باشه
بذارید بیشتر توضیح بدم: من یه کلاس book دارم یک booksArray که تو یه کلاس دیگه ای مثل کلاس آموزش تعریف شده حالا تو یه فرم با کلیک روی یه دکمه باید شی از کلاس book ساخته بشه و تو booksArray ذخیره بشه که برای این کار من یه شی از کلاس book رو ساختم و اطلاغات رو از TextBoxها میگیرم وتوی booksArray یه شی از کلاس آموزش که دارم ذخیره میکنم حالا میخوام با یه دکمه دیگه با دادن کد یه کتابی که تو booksArray دارم (با متدی چک می کنم) بقیه اصلاعات کتاب رو تو TextBox ها نمایش بدم که اینجا رو نمیدونم چیکار کنم لطفا واضح تر راهنمایی کنید .....
نقل قول: جستجو در ArrayList
نقل قول:
نوشته شده توسط
Marzieh-H
بذارید بیشتر توضیح بدم: من یه کلاس book دارم یک booksArray که تو یه کلاس دیگه ای مثل کلاس آموزش تعریف شده حالا تو یه فرم با کلیک روی یه دکمه باید شی از کلاس book ساخته بشه و تو booksArray ذخیره بشه که برای این کار من یه شی از کلاس book رو ساختم و اطلاغات رو از TextBoxها میگیرم وتوی booksArray یه شی از کلاس آموزش که دارم ذخیره میکنم حالا میخوام با یه دکمه دیگه با دادن کد یه کتابی که تو booksArray دارم (با متدی چک می کنم) بقیه اصلاعات کتاب رو تو TextBox ها نمایش بدم که اینجا رو نمیدونم چیکار کنم لطفا واضح تر راهنمایی کنید .....
توضیحتان گیج کننده است، دوباره ساده تر توضیح بدید (اینکه چکار میکنید مهم نیست، اینکه چی هست و چکاری لازم است که انجام بشد را توضیح بدید).
تا جایی که من فهمیدم یک آرایه از کتاب دارید و میخواهید که در کنترلهایی با داتا بایندینگ نمیاشش بدید؟ اگر که نه توضیح ساده تر بدید یا هم کد بفرستید.
نقل قول: جستجو در ArrayList
نقل قول:
نوشته شده توسط
Marzieh-H
سلام دوستان
من Arraylist ای دارم که آبجکتهایی از یه کلاسی که خودم ساختم دارم حالا میخوام یه آیتم مشخصی رو تو این Arraylist پیدا کنم که البته میدونم باید از Contains استفاده کنم و بعد در ضورت وجود چنین آیتمی، دیگر آیتمهای این Arraylist رو در TextBoxهایی نمایش بدم حالا باید چیکار کنم؟؟؟
نقل قول:
بذارید بیشتر توضیح بدم: من یه کلاس book دارم یک booksArray که تو یه کلاس دیگه ای مثل کلاس آموزش تعریف شده حالا تو یه فرم با کلیک روی یه دکمه باید شی از کلاس book ساخته بشه و تو booksArray ذخیره بشه که برای این کار من یه شی از کلاس book رو ساختم و اطلاغات رو از TextBoxها میگیرم وتوی booksArray یه شی از کلاس آموزش که دارم ذخیره میکنم حالا میخوام با یه دکمه دیگه با دادن کد یه کتابی که تو booksArray دارم (با متدی چک می کنم) بقیه اصلاعات کتاب رو تو TextBox ها نمایش بدم که اینجا رو نمیدونم چیکار کنم لطفا واضح تر راهنمایی کنید .....
این 2 تا خیلی با هم فرق دارن ...
ArrayList array = new ArrayList();
Book b = array.Cast<Book>().First(n => n.CodeKetab == TextBoxCodeKetab.Text);
textboxName.Text = b.name;
textboxAuther.Text = b.Auther;
نقل قول: جستجو در ArrayList
نقل قول:
نوشته شده توسط
اَرژنگ
تا جایی که من فهمیدم یک آرایه از کتاب دارید و میخواهید که در کنترلهایی با داتا بایندینگ نمیاشش بدید؟
تقریبا منظورم همینه .
نقل قول: جستجو در ArrayList
نقل قول:
نوشته شده توسط
Marzieh-H
تقریبا منظورم همینه .
اگر از بایندینگ سورس استفاده میکنید مشکلی نیست، داتاسورس بایندینگ سورس را به عنصر آرایه ربط بدید.
قبلاً مثال در این زمینه فرستاده شده بود.