Q & A

시삽: 레드플러스 님 
게시판 이동:
 제목 : 디버거 오류
글번호: 385
작성자: 김태형
작성일: 2006/10/29 오후 8:31:00
조회수: 4110
쌩초보 인데요. 디버그 하는 도중에 이런 오류는 어떻게 처리 하나요.. 제발 도와 주세요
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace FormTest
{
    /// <summary>
    /// Form1에 대한 요약 설명입니다.
    /// </summary>
    public class frmTest : System.Windows.Forms.Form
    {
        internal System.Windows.Forms.Label label1;
        internal System.Windows.Forms.Label label2;
        internal System.Windows.Forms.Label label3;
        internal System.Windows.Forms.ComboBox cmbType;
        internal System.Windows.Forms.ComboBox cmbPos;
        internal System.Windows.Forms.ComboBox cmbMode;
        internal System.Windows.Forms.Button btnCreate;
        /// <summary>
        /// 필수 디자이너 변수입니다.
        /// </summary>
        private System.ComponentModel.Container components = null;

        public frmTest()
        {
            //
            // Windows Form 디자이너 지원에 필요합니다.
            //
            InitializeComponent();

            //
            // TODO: InitializeComponent를 호출한 다음 생성자 코드를 추가합니다.
            //
        }

        /// <summary>
        /// 사용 중인 모든 리소스를 정리합니다.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if (components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

        #region Windows Form 디자이너에서 생성한 코드
        /// <summary>
        /// 디자이너 지원에 필요한 메서드입니다.
        /// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.
        /// </summary>
        private void InitializeComponent()
        {
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.cmbType = new System.Windows.Forms.ComboBox();
            this.cmbPos = new System.Windows.Forms.ComboBox();
            this.cmbMode = new System.Windows.Forms.ComboBox();
            this.btnCreate = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // label1
            //
            this.label1.Location = new System.Drawing.Point(32, 24);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(48, 16);
            this.label1.TabIndex = 0;
            this.label1.Text = "폼 속성";
            //
            // label2
            //
            this.label2.Location = new System.Drawing.Point(32, 88);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(48, 16);
            this.label2.TabIndex = 1;
            this.label2.Text = "폼위치";
            //
            // label3
            //
            this.label3.Location = new System.Drawing.Point(32, 144);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(48, 16);
            this.label3.TabIndex = 2;
            this.label3.Text = "폼종류";
            //
            // cmbType
            //
            this.cmbType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cmbType.Location = new System.Drawing.Point(96, 24);
            this.cmbType.Name = "cmbType";
            this.cmbType.Size = new System.Drawing.Size(152, 20);
            this.cmbType.TabIndex = 3;
            //
            // cmbPos
            //
            this.cmbPos.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cmbPos.Location = new System.Drawing.Point(96, 88);
            this.cmbPos.Name = "cmbPos";
            this.cmbPos.Size = new System.Drawing.Size(152, 20);
            this.cmbPos.TabIndex = 4;
            //
            // cmbMode
            //
            this.cmbMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            this.cmbMode.Location = new System.Drawing.Point(96, 136);
            this.cmbMode.Name = "cmbMode";
            this.cmbMode.Size = new System.Drawing.Size(152, 20);
            this.cmbMode.TabIndex = 5;
            //
            // btnCreate
            //
            this.btnCreate.Location = new System.Drawing.Point(272, 80);
            this.btnCreate.Name = "btnCreate";
            this.btnCreate.Size = new System.Drawing.Size(96, 40);
            this.btnCreate.TabIndex = 6;
            this.btnCreate.Text = "폼생성";
            this.btnCreate.Click += new System.EventHandler(this.btnCreate_Click);
            //
            // frmTest
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
            this.ClientSize = new System.Drawing.Size(392, 206);
            this.Controls.Add(this.btnCreate);
            this.Controls.Add(this.cmbMode);
            this.Controls.Add(this.cmbPos);
            this.Controls.Add(this.cmbType);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Name = "frmTest";
            this.Text = "폼 생성 테스트";
            this.Load += new System.EventHandler(this.frmTest_Load);
            this.ResumeLayout(false);

        }
        #endregion

        /// <summary>
        /// 해당 응용 프로그램의 주 진입점입니다.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.Run(new frmTest());
        }

        private void frmTest_Load(object sender, System.EventArgs e)
        {
            // 콤보 상자 초기값 설정
            cmbType.Items.Add("None");
            cmbType.Items.Add("FixedSingle");
            cmbType.Items.Add("Fixed3D");
            cmbType.Items.Add("FoxedDialog");
            cmbType.Items.Add("Sizable");
            cmbType.Items.Add("FixedToolWindow");
            cmbType.Items.Add("SizableToolWindow");

            cmbPos.Items.Add("Manual");
            cmbPos.Items.Add("CenterScreen");
            cmbPos.Items.Add("WindowsDefaultLocation");
            cmbPos.Items.Add("WindowsDefaultBounds");
            cmbPos.Items.Add("CenterParent");


            cmbMode.Items.Add("모달");
            cmbMode.Items.Add("모달리스");

            //초기 선택값 설정

            cmbType.SelectedIndex=0;
            cmbPos.SelectedIndex=0;
            cmbMode.SelectedIndex=0;

        }

        private void btnCreate_Click(object sender, System.EventArgs e)
        {
            FormTest.frmCreate testDialog = new FormTest.frmCreate();

            // 속성설정

            if(cmbType.SelectedIndex = 0)
                        testDialog.FormBorderStyle
                        = System.Windows.Forms.FormBorderStyle.None;
            else if(cmbType.SelectedIndex = 1)
                        testDialog.FormBorderStyle
                        = System.Windows.Forms.FormBorderStyle.FixedSingle;
            else if(cmbType.SelectedIndex = 2)
                        testDialog.FormBorderStyle
                        = System.Windows.Forms.FormBorderStyle.Fixed3D;
            else if(cmbType.SelectedIndex = 3)
                        testDialog.FormBorderStyle
                        = System.Windows.Forms.FormBorderStyle.FixedDialog;
            else if(cmbType.SelectedIndex = 4)
                        testDialog.FormBorderStyle
                        = System.Windows.Forms.FormBorderStyle.Sizable;
            else if(cmbType.SelectedIndex = 5)
                        testDialog.FormBorderStyle
                        = System.Windows.Forms.FormBorderStyle.FixedToolWindow;

            else
                        testDialog.FormBorderStyle
                        = System.Windows.Forms.FormBorderStyle.SizableToolWindow;



            if(cmbPos.SelectedIndex = 0)
                        testDialog.StartPosition =
                        System.Windows.Forms.FormStartPosition.Manual;

            else if(cmbPos.SelectedIndex = 1)
                        testDialog.StartPosition =
                        System.Windows.Forms.FormStartPosition.CenterScreen;

            else if(cmbPos.SelectedIndex = 2)
                        testDialog.StartPosition =
                        System.Windows.Forms.FormStartPosition.WindowsDefaultLocation;

            else if(cmbPos.SelectedIndex = 3)
                        testDialog.StartPosition =
                        System.Windows.Forms.FormStartPosition.WindowsDefaultBounds;

            else
                        testDialog.StartPosition =
                        System.Windows.Forms.FormStartPosition.CenterParent;

            // 속성에 맞는 문자열 출력

            testDialog.lblType.text = cmbType.SelectedItem.ToString();
            testDialog.lblPos.text = cmbPos.SelectedItem.ToString();

            if(cmbMode.SelectedIndex = 0 )
            {
                testDialog.ShowDialog(this);
                testDialog.Dispose();

            }
            else
            {
                testDialog.Show();

            }


        }
    }
}



using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace FormTest
{
    /// <summary>
    /// frmCreate에 대한 요약 설명입니다.
    /// </summary>
    public class frmCreate : System.Windows.Forms.Form
    {
        internal System.Windows.Forms.Label label3;
        internal System.Windows.Forms.Label label2;
        internal System.Windows.Forms.Label label1;
        internal System.Windows.Forms.Label lblType;
        internal System.Windows.Forms.Label lblPos;
        internal System.Windows.Forms.Label lblMode;
        internal System.Windows.Forms.Button btnOk;
        /// <summary>
        /// 필수 디자이너 변수입니다.
        /// </summary>
        private System.ComponentModel.Container components = null;

        public frmCreate()
        {
            //
            // Windows Form 디자이너 지원에 필요합니다.
            //
            InitializeComponent();

            //
            // TODO: InitializeComponent를 호출한 다음 생성자 코드를 추가합니다.
            //
        }

        /// <summary>
        /// 사용 중인 모든 리소스를 정리합니다.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if(components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

        #region Windows Form 디자이너에서 생성한 코드
        /// <summary>
        /// 디자이너 지원에 필요한 메서드입니다.
        /// 이 메서드의 내용을 코드 편집기로 수정하지 마십시오.
        /// </summary>
        private void InitializeComponent()
        {
            this.label3 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.label1 = new System.Windows.Forms.Label();
            this.lblType = new System.Windows.Forms.Label();
            this.lblPos = new System.Windows.Forms.Label();
            this.lblMode = new System.Windows.Forms.Label();
            this.btnOk = new System.Windows.Forms.Button();
            this.SuspendLayout();
            //
            // label3
            //
            this.label3.Location = new System.Drawing.Point(32, 168);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(48, 16);
            this.label3.TabIndex = 5;
            this.label3.Text = "폼종류";
            //
            // label2
            //
            this.label2.Location = new System.Drawing.Point(32, 112);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(48, 16);
            this.label2.TabIndex = 4;
            this.label2.Text = "폼위치";
            //
            // label1
            //
            this.label1.Location = new System.Drawing.Point(32, 48);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(48, 16);
            this.label1.TabIndex = 3;
            this.label1.Text = "폼 속성";
            //
            // lblType
            //
            this.lblType.Location = new System.Drawing.Point(104, 48);
            this.lblType.Name = "lblType";
            this.lblType.Size = new System.Drawing.Size(216, 16);
            this.lblType.TabIndex = 6;
            this.lblType.Text = "label4";
            //
            // lblPos
            //
            this.lblPos.Location = new System.Drawing.Point(104, 112);
            this.lblPos.Name = "lblPos";
            this.lblPos.Size = new System.Drawing.Size(232, 24);
            this.lblPos.TabIndex = 7;
            this.lblPos.Text = "label5";
            //
            // lblMode
            //
            this.lblMode.Location = new System.Drawing.Point(104, 160);
            this.lblMode.Name = "lblMode";
            this.lblMode.Size = new System.Drawing.Size(232, 32);
            this.lblMode.TabIndex = 8;
            this.lblMode.Text = "label6";
            //
            // btnOk
            //
            this.btnOk.Location = new System.Drawing.Point(352, 88);
            this.btnOk.Name = "btnOk";
            this.btnOk.Size = new System.Drawing.Size(88, 32);
            this.btnOk.TabIndex = 9;
            this.btnOk.Text = "확인";
            this.btnOk.Click += new System.EventHandler(this.btnOk_Click);
            //
            // frmCreate
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
            this.ClientSize = new System.Drawing.Size(464, 222);
            this.Controls.Add(this.btnOk);
            this.Controls.Add(this.lblMode);
            this.Controls.Add(this.lblPos);
            this.Controls.Add(this.lblType);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.label1);
            this.Name = "frmCreate";
            this.Text = "생성된폼";
            this.Load += new System.EventHandler(this.frmCreate_Load);
            this.ResumeLayout(false);

        }
        #endregion

        private void frmCreate_Load(object sender, System.EventArgs e)
        {
            if(this.Modal = true)
                        lblMode.Text = "모달 폼";
                        else
                        lblMode.Text = "모달리스 폼";
                    
        }

        private void btnOk_Click(object sender, System.EventArgs e)
        {
            this.Close();
        
        }
    }
}

System.Windows.Forms.Form.Modal' 속성 또는 인덱서는 읽기 전용이므로 할당할 수 없습니다.
조건식에 대입문을 사용하면 항상 상수가 됩니다. = 대신 ==을 사용하십시오.
암시적으로 'int' 형식을 'bool' 형식으로 변환할 수 없습니다.
보호 수준 때문에 'System.Windows.Forms.Control.text'에 액세스할 수 없습니다.


 
이전 글   다음 글 삭제 수정 답변 글쓰기 리스트
  tomochan
  2006-11-06 오후 3:48:46
if(this.Modal = true)
                              lblMode.Text = "모달 폼";
                              else
                              lblMode.Text = "모달리스 폼";
구문에서 실수하셨네요..

= 는 대입할때의 기호이지요.
같다고 할때.즉 equal은 ==입니다...오류메세지에 친절히 나와있네요 -_-a

  skyturbo
  2006-11-13 오후 10:32:43
헐..질문 하신분 대단..소스전체공개와 스크롤의 압박..ㅡㅡ;

(댓글을 남기려면 로그인이 필요합니다.)

관련 아티클 리스트
  제       목 파일 작성자 작성일 조회
이전글 선생님 잘 지내시죠 ^^ (2) - 심민섭 2006-11-06 3190
현재글 디버거 오류(2) - 김태형 2006-10-29 4110
다음글 질문있습니다^^(1) - 임진수 2006-10-24 3066
 
손님 사용자 Anonymous (손님)
로그인 Home