Конференция ".Net" » C# указатель на System.Windows.Forms.Form [C#, WinXP]
 
  • cherrex © (09.12.05 10:38) [0]
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace WindowsApplication6
    {
       public partial class Form2 : Form
       {
           public Form2()
           {
               InitializeComponent();
           }


           public unsafe System.Windows.Forms.Form* F1;

           private void button1_Click(object sender, EventArgs e)
           {
               textBox1.Text = "OK!";
           }


        }
    }



    По чему выводит ошибка
    public unsafe System.Windows.Forms.Form* F1



    Cannot take the address of, get the size of, or declare a pointer to a managed type ('System.Windows.Forms.Form.Form')
  • alex_*** © (09.12.05 10:58) [1]
    переменная этого типа и есть указатель. а что ты хочешь?
  • DiamondShark © (09.12.05 11:03) [2]
    А зачем нужна такая конструкция?
  • cherrex © (09.12.05 11:20) [3]
    Просто пробую что можно, а что нелзя. Вообщето я пробывал в Delphi 2005 но не с System.Windows.Forms.Form, а с DataSet и все работало, а в VS не System.Windows.Forms.Form не DataSet.
  • Lamer@fools.ua © (09.12.05 21:04) [4]
    >>cherrex ©   (09.12.05 10:38)

    >По чему выводит ошибка
    В сообщении об ошибке написано почему. Перевести?

    Вообще, прежде чем что-то использовать, неплохо справку читать:
    In an unsafe context, a type may be a pointer type as well as a value type or a reference type. A pointer type declaration takes one of the following forms:


    unmanaged type* identifier;
    void* identifier;


    Parameters
    unmanaged type

    One of the following:

    sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, or bool.

    Any enum type.

    Any pointer type.

    Any user-defined struct type that contains fields of unmanaged types only.

    identifier
    The pointer variable name.

  • cherrex © (10.12.05 12:59) [5]
    Значит это можно делать только с типами : sbyte, byte, short, ushort, int, uint, long, ulong, char, float, double, decimal, or bool. Я правелно понял?
  • A22 © (12.12.05 02:13) [6]
    ЭТО можно делать со всеми не-мэнеджед типами.
 
Конференция ".Net" » C# указатель на System.Windows.Forms.Form [C#, WinXP]
Есть новые Нет новых   [120091   +49][b:0][p:0.001]