نمایش نتایج 1 تا 7 از 7

نام تاپیک: اررور در redim

  1. #1
    کاربر دائمی آواتار just4froum
    تاریخ عضویت
    تیر 1390
    محل زندگی
    تهران
    پست
    695

    اررور در redim

    با سلام به همگی :

    آیا کسی میدونه چرا برنامه از این دو خط ایراد میگیره ؟؟؟

    ReDim Preserve x(0, 0, 24)
    ReDim Preserve x(0, 1, 24)

    مگه ما در قسمت بالا بر آرایه اضافه نکردیم ؟؟؟

    ولی وقتی کلمه ی Preserve رو از خط دوم بر میداریم درست میشه ولی خوب اطلاعات قبل میپره !!!

    با تشکر

  2. #2
    کاربر دائمی آواتار butterfly8528
    تاریخ عضویت
    شهریور 1387
    محل زندگی
    CLR
    پست
    896

    نقل قول: اررور در redim

    سلام دوست عزیز .

    You can use the ReDim statement repeatedly to change the number of elements and dimensions in an array. However, you can't declare an array of one data type and later use ReDim to change the array to another data type, unless the array is contained in a Variant. If the array is contained in a Variant, the type of the elements can be changed using an As type clause, unless you’re using the Preserve keyword, in which case, no changes of data type are permitted.

    If you use the Preserve keyword, you can resize only the last array dimension and you can't change the number of dimensions at all. For example, if your array has only one dimension, you can resize that dimension because it is the last and only dimension. However, if your array has two or more dimensions, you can change the size of only the last dimension and still preserve the contents of the array. The following example shows how you can increase the size of the last dimension of a dynamic array without erasing any existing data contained in the array.

    ReDim X(10, 10, 10)
    . . .
    ReDim Preserve X(10, 10, 15)

    Similarly, when you use Preserve, you can change the size of the array only by changing the upper bound; changing the lower bound causes an error.

    If you make an array smaller than it was, data in the eliminated elements will be lost. If you pass an array to a procedure by reference, you can't redimension the array within the procedure.

    MSDN




    موفق باشید .

  3. #3
    کاربر دائمی آواتار just4froum
    تاریخ عضویت
    تیر 1390
    محل زندگی
    تهران
    پست
    695

    نقل قول: اررور در redim

    پس نتيجه ميگيريم اين كار شدني نيست !!!

    با تشكر

  4. #4
    کاربر دائمی آواتار M.T.P
    تاریخ عضویت
    دی 1388
    محل زندگی
    Planet Earth
    پست
    1,769

    نقل قول: اررور در redim

    نقل قول نوشته شده توسط just4froum مشاهده تاپیک
    پس نتيجه ميگيريم اين كار شدني نيست !!!

    با تشكر
    Preserve رو بردارید ، درست میشه
    Preserve فقط اجازه تغییر سلول آخر رو میده

  5. #5
    کاربر دائمی آواتار just4froum
    تاریخ عضویت
    تیر 1390
    محل زندگی
    تهران
    پست
    695

    نقل قول: اررور در redim

    نقل قول نوشته شده توسط M.T.P مشاهده تاپیک
    Preserve رو بردارید ، درست میشه
    Preserve فقط اجازه تغییر سلول آخر رو میده
    خوب مشکل من هم همینه اگه preserve رو بردارم اطلاعاتم میپره !!!

  6. #6
    کاربر دائمی آواتار M.T.P
    تاریخ عضویت
    دی 1388
    محل زندگی
    Planet Earth
    پست
    1,769

    نقل قول: اررور در redim

    خب اصلش همینه ، اول باید ساختار آرایه رو درست کنید بعد پرش کنید.
    کدتون چی هست؟ شاید بشه یه فکری به حالش کرد!

  7. #7
    کاربر دائمی آواتار just4froum
    تاریخ عضویت
    تیر 1390
    محل زندگی
    تهران
    پست
    695

    نقل قول: اررور در redim

    با تشکر از جناب M.T.P :

    خودم یه فکری براش کردم و مجبور شدم کل کدمو بریزم بهم.

قوانین ایجاد تاپیک در تالار

  • شما نمی توانید تاپیک جدید ایجاد کنید
  • شما نمی توانید به تاپیک ها پاسخ دهید
  • شما نمی توانید ضمیمه ارسال کنید
  • شما نمی توانید پاسخ هایتان را ویرایش کنید
  •