Avatar billede ghorfraq Nybegynder
30. oktober 2003 - 09:20 Der er 3 kommentarer og
1 løsning

Datagrid i forms

Har medsendt en bunke kode. Problemet er at jeg ved oprettelse af et dataset i et datagrid har problemer. Jeg opretter en form – jobvalg hvor jeg kan udhente 2 datagrids. Dette gøres ved tryk på knappen bOrdreNummer. Det første til valg af en ordrebeskrivelse. Denne virker fint. Det andet skal så bruges til at udvælge operationsbeskrivelse. Men når jeg prøver at åbne denne form ved tryk på bOperation knappen i JobValg formen får jeg en fejl i runtime.
Den siger – cannot create a child list for field TidsurOperationer

Jeg ved godt dette er en kæmpe omgang kode, men håber der findes en venlig sjæl med lidt tid og overskud



DoWork DIALOG:
---------------------------------------------------------------------
public SimplePacket doWork(string command, SimplePacket packet)
        {   
            if(packet == null)
            {
                ;
            }
            else
            {
                this.packet = packet;
            }

            if (command == "Sagsordre" || command == "Produktionsordre")
            {
                this.packet.SCommand = "OrdreBeskrivelse";
            }
            else
            {
                this.packet.SCommand = command;
            }

            if(tidsurdialog.TxtKortnr.Equals(""))
            {
                MessageBox.Show("Indtast KortNummer!\n");
                return packet;
            }       
           
            switch(this.packet.SCommand)
            {
               
               
                case "JobValg":
                    jobValg();
                    break;

                case "OrdreBeskrivelse":
                    ordreBeskrivelse();
                    break;               
                   
                case "OperationsBeskrivelse":
                    operationsBeskrivelse();
                    break;
                     
                default:
                    MessageBox.Show("Ukendt kommando");
                    break;                   
            }
            return this.packet;           
        }
-----------------------------------------------------------------------





operationsvalg og ordrebeskrivelse
private void operationsBeskrivelse()
        {
            TidsursOperationer t = new TidsursOperationer();

            sendPacket();
            receiveSetPacket();

            // Instantiate the DataSet variable.
            DataSet myDataSet = new DataSet();
       
            //DataTable
            DataTable myDatatable = new DataTable("TidsursOperationer");

            // Create new DataColumn, set DataType, ColumnName and add to DataTable.   
            DataColumn myDatacolumn = new DataColumn();
            myDatacolumn.DataType = Type.GetType("System.String");
            myDatacolumn.ColumnName = "Operationsnummer";
            myDatacolumn.ReadOnly = true;
            myDatacolumn.Unique = false;
            myDatacolumn.AllowDBNull = true;
            // Add the Column to the DataColumnCollection.
            myDatatable.Columns.Add(myDatacolumn);

            // Create new DataColumn, set DataType, ColumnName and add to DataTable.   
            myDatacolumn = new DataColumn();
            myDatacolumn.DataType = Type.GetType("System.String");
            myDatacolumn.ColumnName = "Beskrivelse";
            myDatacolumn.ReadOnly = true;
            myDatacolumn.Unique = false;
            myDatacolumn.AllowDBNull = true;
            // Add the Column to the DataColumnCollection.
            myDatatable.Columns.Add(myDatacolumn);
           
            DataRow myDatarow;
            for(int i = 0; i < setPacket.GetSize(); i++)
            {
                myDatarow = myDatatable.NewRow();
                myDatarow["Operationsnummer"] = setPacket.GetSOperation(i);
                myDatarow["Beskrivelse"] = setPacket.GetSOpBeskrivelse(i);               

                myDatatable.Rows.Add(myDatarow);
            }

            t.dataGrid.SetDataBinding(myDataSet, "TidsursOperationer");           
            t.Show();
        }

        #region OrdreBeskrivelse
        private void ordreBeskrivelse()
        {               
            OversigtDialog p = new OversigtDialog();
            packet.SOrdreType = jobvalg.CbOrdretype;
           
            sendPacket();
           
            receiveSetPacket();           
           
            if (packet.SOrdreType.Equals("Sagsordre"))
            {                                                                               
                // Instantiate the DataSet variable.
                DataSet myDataSet = new DataSet();
       
                //DataTable
                DataTable myDataTable = new DataTable("Sagsordre");

                // Create new DataColumn, set DataType, ColumnName and add to DataTable.   
                DataColumn myDataColumn = new DataColumn();
                myDataColumn.DataType = Type.GetType("System.String");
                myDataColumn.ColumnName = "Ordrenummer";
                myDataColumn.ReadOnly = true;
                myDataColumn.Unique = false;
                // Add the Column to the DataColumnCollection.
                myDataTable.Columns.Add(myDataColumn);
               
                // Create second column.
                myDataColumn = new DataColumn();
                myDataColumn.DataType = System.Type.GetType("System.String");
                myDataColumn.ColumnName = "Beskrivelse1";
                myDataColumn.AutoIncrement = false;
                myDataColumn.Caption = "Betegnelse";
                myDataColumn.ReadOnly = true;
                myDataColumn.Unique = false;
                // Add the column to the table.
                myDataTable.Columns.Add(myDataColumn);

                // Create third column.
                myDataColumn = new DataColumn();
                myDataColumn.DataType = System.Type.GetType("System.String");
                myDataColumn.ColumnName = "Beskrivelse2";
                myDataColumn.AutoIncrement = false;
                myDataColumn.Caption = "Beskrivelse";
                myDataColumn.ReadOnly = true;
                myDataColumn.Unique = false;
                // Add the column to the table.
                myDataTable.Columns.Add(myDataColumn);
               
                // Create fourth column.
                myDataColumn = new DataColumn();
                myDataColumn.DataType = System.Type.GetType("System.String");
                myDataColumn.ColumnName = "Startdato";
                myDataColumn.AutoIncrement = false;
                myDataColumn.Caption = "StartDato";
                myDataColumn.ReadOnly = true;
                myDataColumn.Unique = false;
                // Add the column to the table.
                myDataTable.Columns.Add(myDataColumn);

                // Create fifth column.
                myDataColumn = new DataColumn();
                myDataColumn.DataType = System.Type.GetType("System.String");
                myDataColumn.ColumnName = "Slutdato";
                myDataColumn.AutoIncrement = false;
                myDataColumn.Caption = "Slutdato";
                myDataColumn.ReadOnly = true;
                myDataColumn.Unique = false;
                // Add the column to the table.
                myDataTable.Columns.Add(myDataColumn);
               
                // Create sixth column.
                myDataColumn = new DataColumn();
                myDataColumn.DataType = System.Type.GetType("System.String");
                myDataColumn.ColumnName = "Ansvarlig Montør";
                myDataColumn.AutoIncrement = false;
                myDataColumn.Caption = "Montør";
                myDataColumn.ReadOnly = true;
                myDataColumn.Unique = false;
                // Add the column to the table.
                myDataTable.Columns.Add(myDataColumn);

                // Create seventh column.
                myDataColumn = new DataColumn();
                myDataColumn.DataType = System.Type.GetType("System.String");
                myDataColumn.ColumnName = "Projektkode";
                myDataColumn.AutoIncrement = false;
                myDataColumn.Caption = "Projektkode";
                myDataColumn.ReadOnly = true;
                myDataColumn.Unique = false;
                // Add the column to the table.
                myDataTable.Columns.Add(myDataColumn);

                // Create eight column.
                myDataColumn = new DataColumn();
                myDataColumn.DataType = System.Type.GetType("System.String");
                myDataColumn.ColumnName = "Opstartsmøde";
                myDataColumn.AutoIncrement = false;
                myDataColumn.Caption = "Opstartsmøde";
                myDataColumn.ReadOnly = true;
                myDataColumn.Unique = false;
                // Add the column to the table.
                myDataTable.Columns.Add(myDataColumn);
                // Add the new DataTable to the DataSet.
                myDataSet.Tables.Add(myDataTable);

                DataRow myDataRow;                                   
   
                for(int i = 0; i < setPacket.GetSize(); i++)
                {
                    myDataRow = myDataTable.NewRow();
                    myDataRow["Ordrenummer"] = setPacket.GetSOrdreNum(i);
                    myDataRow["Beskrivelse1"] = setPacket.GetSBeskrivelse1(i);
                    myDataRow["Beskrivelse2"] = setPacket.GetSBeskrivelse2(i);
                    myDataRow["Startdato"] = setPacket.GetSStartDate(i);
                    myDataRow["Slutdato"] = setPacket.GetSStopDate(i);
                    myDataRow["Ansvarlig Montør"] = setPacket.GetSAnsvarligMontoer(i);
                    myDataRow["Projektkode"] = setPacket.GetSProjektKode(i);
                    myDataRow["Opstartsmøde"] = setPacket.GetSOpstartsMoede(i);

                    myDataTable.Rows.Add(myDataRow);
                }

                p.dataGrid1.SetDataBinding(myDataSet, "Sagsordre");                                               
            }
            else if (packet.SOrdreType.Equals("Produktionsordre"))
            {                                   
                // Instantiate the DataSet variable.
                DataSet myDataSet = new DataSet();
       
                //DataTable
                DataTable myDataTable = new DataTable("Produktionsordre");

                // Create new DataColumn, set DataType, ColumnName and add to DataTable.   
                DataColumn myDataColumn = new DataColumn();
                myDataColumn.DataType = Type.GetType("System.String");
                myDataColumn.ColumnName = "Ordrenummer";
                myDataColumn.ReadOnly = true;
                myDataColumn.Unique = false;
                // Add the Column to the DataColumnCollection.
                myDataTable.Columns.Add(myDataColumn);
               
                // Create second column.
                myDataColumn = new DataColumn();
                myDataColumn.DataType = System.Type.GetType("System.String");
                myDataColumn.ColumnName = "Beskrivelse1";
                myDataColumn.AutoIncrement = false;
                myDataColumn.Caption = "Betegnelse";
                myDataColumn.ReadOnly = true;
                myDataColumn.Unique = false;
                // Add the column to the table.
                myDataTable.Columns.Add(myDataColumn);

                // Create third column.
                myDataColumn = new DataColumn();
                myDataColumn.DataType = System.Type.GetType("System.String");
                myDataColumn.ColumnName = "Beskrivelse2";
                myDataColumn.AutoIncrement = false;
                myDataColumn.Caption = "Beskrivelse";
                myDataColumn.ReadOnly = true;
                myDataColumn.Unique = false;
                // Add the column to the table.
                myDataTable.Columns.Add(myDataColumn);
               
                // Create fourth column.
                myDataColumn = new DataColumn();
                myDataColumn.DataType = System.Type.GetType("System.String");
                myDataColumn.ColumnName = "Startdato";
                myDataColumn.AutoIncrement = false;
                myDataColumn.Caption = "StartDato";
                myDataColumn.ReadOnly = true;
                myDataColumn.Unique = false;
                // Add the column to the table.
                myDataTable.Columns.Add(myDataColumn);

                // Create fifth column.
                myDataColumn = new DataColumn();
                myDataColumn.DataType = System.Type.GetType("System.String");
                myDataColumn.ColumnName = "Slutdato";
                myDataColumn.AutoIncrement = false;
                myDataColumn.Caption = "Slutdato";
                myDataColumn.ReadOnly = true;
                myDataColumn.Unique = false;
                // Add the column to the table.
                myDataTable.Columns.Add(myDataColumn);
               
                // Add the new DataTable to the DataSet.
                myDataSet.Tables.Add(myDataTable);

                DataRow myDataRow;                                   
   
                for(int i = 0; i < setPacket.GetSize(); i++)
                {
                    myDataRow = myDataTable.NewRow();
                    myDataRow["Ordrenummer"] = setPacket.GetSOrdreNum(i);
                    myDataRow["Beskrivelse1"] = setPacket.GetSBeskrivelse1(i);
                    myDataRow["Beskrivelse2"] = setPacket.GetSBeskrivelse2(i);
                    myDataRow["Startdato"] = setPacket.GetSStartDate(i);
                    myDataRow["Slutdato"] = setPacket.GetSStopDate(i);
                    myDataTable.Rows.Add(myDataRow);
                }

                p.dataGrid1.SetDataBinding(myDataSet, "Produktionsordre");                   
            }
            else
                MessageBox.Show("Fejl Ved bearbejdelse af ordreBeskrivelse!");                                   
       
            p.Show();
        }
        #endregion
----------------------------------------------------------------------





JobValg DIALOG:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Tidsur.delt;

namespace TidsurClient
{   
    public class JobValgDialog : System.Windows.Forms.Form
    {       
        private TidsurFunctions tidsur;
        private TidsurDialog tidsurdialog;       

        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.Button bAnnuller;
        private System.Windows.Forms.Button bOk;
        private System.Windows.Forms.Button bOperation;
        private System.Windows.Forms.Button bOrdreNummer;
        private System.Windows.Forms.TextBox txtOperation_2;
        private System.Windows.Forms.TextBox txtOperation_1;
        private System.Windows.Forms.TextBox txtOrdreNummer_3;
        private System.Windows.Forms.TextBox txtOrdreNummer_2;
        private System.Windows.Forms.TextBox txtOrdreNummer_1;
        private System.Windows.Forms.ComboBox cbOrdretype;
        private System.Windows.Forms.TextBox txtNavn;
        private System.Windows.Forms.TextBox txtNummer;
        private System.Windows.Forms.Label lblOperation;
        private System.Windows.Forms.Label lblOrdreNummer;
        private System.Windows.Forms.Label lblOrdretype;
        private System.Windows.Forms.Label lblNavn;
        private System.Windows.Forms.Label lblNummer;
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;

        public JobValgDialog(TidsurDialog tidsurdialog, TidsurFunctions tidsur)
        {
            this.tidsur = tidsur;
            this.tidsurdialog = tidsurdialog;           
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if(components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.bAnnuller = new System.Windows.Forms.Button();
            this.bOk = new System.Windows.Forms.Button();
            this.txtOperation_2 = new System.Windows.Forms.TextBox();
            this.bOperation = new System.Windows.Forms.Button();
            this.bOrdreNummer = new System.Windows.Forms.Button();
            this.txtOperation_1 = new System.Windows.Forms.TextBox();
            this.txtOrdreNummer_3 = new System.Windows.Forms.TextBox();
            this.txtOrdreNummer_2 = new System.Windows.Forms.TextBox();
            this.txtOrdreNummer_1 = new System.Windows.Forms.TextBox();
            this.cbOrdretype = new System.Windows.Forms.ComboBox();
            this.txtNavn = new System.Windows.Forms.TextBox();
            this.txtNummer = new System.Windows.Forms.TextBox();
            this.lblOperation = new System.Windows.Forms.Label();
            this.lblOrdreNummer = new System.Windows.Forms.Label();
            this.lblOrdretype = new System.Windows.Forms.Label();
            this.lblNavn = new System.Windows.Forms.Label();
            this.lblNummer = new System.Windows.Forms.Label();
            this.groupBox1.SuspendLayout();
            this.SuspendLayout();
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.bAnnuller);
            this.groupBox1.Controls.Add(this.bOk);
            this.groupBox1.Controls.Add(this.txtOperation_2);
            this.groupBox1.Controls.Add(this.bOperation);
            this.groupBox1.Controls.Add(this.bOrdreNummer);
            this.groupBox1.Controls.Add(this.txtOperation_1);
            this.groupBox1.Controls.Add(this.txtOrdreNummer_3);
            this.groupBox1.Controls.Add(this.txtOrdreNummer_2);
            this.groupBox1.Controls.Add(this.txtOrdreNummer_1);
            this.groupBox1.Controls.Add(this.cbOrdretype);
            this.groupBox1.Controls.Add(this.txtNavn);
            this.groupBox1.Controls.Add(this.txtNummer);
            this.groupBox1.Controls.Add(this.lblOperation);
            this.groupBox1.Controls.Add(this.lblOrdreNummer);
            this.groupBox1.Controls.Add(this.lblOrdretype);
            this.groupBox1.Controls.Add(this.lblNavn);
            this.groupBox1.Controls.Add(this.lblNummer);
            this.groupBox1.Location = new System.Drawing.Point(8, 8);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(320, 352);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            //
            // bAnnuller
            //
            this.bAnnuller.Location = new System.Drawing.Point(240, 312);
            this.bAnnuller.Name = "bAnnuller";
            this.bAnnuller.Size = new System.Drawing.Size(64, 32);
            this.bAnnuller.TabIndex = 28;
            this.bAnnuller.Text = "Anuller";
            this.bAnnuller.Click += new System.EventHandler(this.button4_Click);
            //
            // bOk
            //
            this.bOk.Location = new System.Drawing.Point(160, 312);
            this.bOk.Name = "bOk";
            this.bOk.Size = new System.Drawing.Size(64, 32);
            this.bOk.TabIndex = 27;
            this.bOk.Text = "OK";
            this.bOk.Click += new System.EventHandler(this.button3_Click);
            //
            // txtOperation_2
            //
            this.txtOperation_2.Location = new System.Drawing.Point(144, 264);
            this.txtOperation_2.Name = "txtOperation_2";
            this.txtOperation_2.ReadOnly = true;
            this.txtOperation_2.Size = new System.Drawing.Size(160, 20);
            this.txtOperation_2.TabIndex = 26;
            this.txtOperation_2.Text = "textBox7";
            //
            // bOperation
            //
            this.bOperation.Location = new System.Drawing.Point(248, 232);
            this.bOperation.Name = "bOperation";
            this.bOperation.Size = new System.Drawing.Size(56, 20);
            this.bOperation.TabIndex = 25;
            this.bOperation.Text = "Vælg";
            this.bOperation.Click += new System.EventHandler(this.button2_Click);
            //
            // bOrdreNummer
            //
            this.bOrdreNummer.Location = new System.Drawing.Point(248, 128);
            this.bOrdreNummer.Name = "bOrdreNummer";
            this.bOrdreNummer.Size = new System.Drawing.Size(56, 20);
            this.bOrdreNummer.TabIndex = 24;
            this.bOrdreNummer.Text = "Vælg";
            this.bOrdreNummer.Click += new System.EventHandler(this.button1_Click);
            //
            // txtOperation_1
            //
            this.txtOperation_1.Location = new System.Drawing.Point(144, 232);
            this.txtOperation_1.Name = "txtOperation_1";
            this.txtOperation_1.ReadOnly = true;
            this.txtOperation_1.TabIndex = 23;
            this.txtOperation_1.Text = "textBox6";
            //
            // txtOrdreNummer_3
            //
            this.txtOrdreNummer_3.Location = new System.Drawing.Point(144, 200);
            this.txtOrdreNummer_3.Name = "txtOrdreNummer_3";
            this.txtOrdreNummer_3.ReadOnly = true;
            this.txtOrdreNummer_3.Size = new System.Drawing.Size(160, 20);
            this.txtOrdreNummer_3.TabIndex = 22;
            this.txtOrdreNummer_3.Text = "textBox5";
            //
            // txtOrdreNummer_2
            //
            this.txtOrdreNummer_2.Location = new System.Drawing.Point(144, 168);
            this.txtOrdreNummer_2.Name = "txtOrdreNummer_2";
            this.txtOrdreNummer_2.ReadOnly = true;
            this.txtOrdreNummer_2.Size = new System.Drawing.Size(160, 20);
            this.txtOrdreNummer_2.TabIndex = 21;
            this.txtOrdreNummer_2.Text = "textBox4";
            //
            // txtOrdreNummer_1
            //
            this.txtOrdreNummer_1.Location = new System.Drawing.Point(144, 128);
            this.txtOrdreNummer_1.Name = "txtOrdreNummer_1";
            this.txtOrdreNummer_1.ReadOnly = true;
            this.txtOrdreNummer_1.TabIndex = 20;
            this.txtOrdreNummer_1.Text = "textBox3";
            //
            // cbOrdretype
            //
            this.cbOrdretype.ItemHeight = 13;
            this.cbOrdretype.Items.AddRange(new object[] {
                                                            "Sagsordre",
                                                            "Produktionsordre"});
            this.cbOrdretype.Location = new System.Drawing.Point(144, 88);
            this.cbOrdretype.MaxDropDownItems = 2;
            this.cbOrdretype.Name = "cbOrdretype";
            this.cbOrdretype.Size = new System.Drawing.Size(121, 21);
            this.cbOrdretype.TabIndex = 29;
            //
            // txtNavn
            //
            this.txtNavn.Location = new System.Drawing.Point(144, 56);
            this.txtNavn.Name = "txtNavn";
            this.txtNavn.ReadOnly = true;
            this.txtNavn.Size = new System.Drawing.Size(160, 20);
            this.txtNavn.TabIndex = 18;
            this.txtNavn.Text = "textBox2";
            //
            // txtNummer
            //
            this.txtNummer.Location = new System.Drawing.Point(144, 24);
            this.txtNummer.Name = "txtNummer";
            this.txtNummer.ReadOnly = true;
            this.txtNummer.Size = new System.Drawing.Size(160, 20);
            this.txtNummer.TabIndex = 17;
            this.txtNummer.Text = "textBox1";
            //
            // lblOperation
            //
            this.lblOperation.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblOperation.Location = new System.Drawing.Point(16, 232);
            this.lblOperation.Name = "lblOperation";
            this.lblOperation.TabIndex = 16;
            this.lblOperation.Text = "Operation";
            this.lblOperation.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            //
            // lblOrdreNummer
            //
            this.lblOrdreNummer.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblOrdreNummer.Location = new System.Drawing.Point(16, 128);
            this.lblOrdreNummer.Name = "lblOrdreNummer";
            this.lblOrdreNummer.Size = new System.Drawing.Size(104, 23);
            this.lblOrdreNummer.TabIndex = 15;
            this.lblOrdreNummer.Text = "Ordrenummer";
            this.lblOrdreNummer.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            //
            // lblOrdretype
            //
            this.lblOrdretype.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblOrdretype.Location = new System.Drawing.Point(16, 88);
            this.lblOrdretype.Name = "lblOrdretype";
            this.lblOrdretype.TabIndex = 14;
            this.lblOrdretype.Text = "Ordretype";
            this.lblOrdretype.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            //
            // lblNavn
            //
            this.lblNavn.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblNavn.Location = new System.Drawing.Point(16, 56);
            this.lblNavn.Name = "lblNavn";
            this.lblNavn.TabIndex = 13;
            this.lblNavn.Text = "Navn";
            this.lblNavn.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            //
            // lblNummer
            //
            this.lblNummer.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.lblNummer.Location = new System.Drawing.Point(16, 24);
            this.lblNummer.Name = "lblNummer";
            this.lblNummer.TabIndex = 12;
            this.lblNummer.Text = "Nummer";
            this.lblNummer.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
            //
            // JobValgDialog
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(336, 365);
            this.Controls.Add(this.groupBox1);
            this.Name = "JobValgDialog";
            this.Text = "JobValgDialog";
            this.groupBox1.ResumeLayout(false);
            this.ResumeLayout(false);

        }
        #endregion       

        private void button1_Click(object sender, System.EventArgs e)
        {           
            //ordrebeskrivelse
            if (this.cbOrdretype.Text.Equals(""))
            {
                MessageBox.Show("Vælg Ordretype..");
            }
            else
            {
                string sOrdreType = this.cbOrdretype.Text;               

                tidsur.doWork(sOrdreType, null);               
            }
        }

        private void button2_Click(object sender, System.EventArgs e)
        {
            //Operationsbeskrivelse
            if (this.cbOrdretype.Text.Equals(""))
            {
                MessageBox.Show("Vælg Ordretype..");
            }           
            else
            {
                tidsur.doWork("OperationsBeskrivelse", null);       
            }
        }

        private void button3_Click(object sender, System.EventArgs e)
        {
            //OK

        }

        private void button4_Click(object sender, System.EventArgs e)
        {
            //Annuller
            this.Close();
            tidsurdialog.Show();
        }       
                               
        #region get/set methods
        public string TxtNummer
        {
            set {this.txtNummer.Text = value;}
            get {return this.txtNummer.Text;}
        }

        public string TxtNavn
        {
            set {this.txtNavn.Text = value;}
            get {return this.txtNavn.Text;}
        }
        public string CbOrdretype
        {
            get {return this.cbOrdretype.Text;}
        }

        public string TxtOrdreNummer_1
        {
            set {this.txtOrdreNummer_1.Text = value;}
        }
       
        public string TxtOrdreNummer_2
        {
            set {this.txtOrdreNummer_2.Text = value;}
        }
       
        public string TxtOrdreNummer_3
        {
            set {this.txtOrdreNummer_3.Text = value;}
        }

        public string TxtOperation_1
        {
            set {this.txtOperation_1.Text = value;}
        }

        public string TxtOperation_2
        {
            set {this.txtOperation_2.Text = value;}
        }
        #endregion
    }
}
--------------------------------------------------------------------



OVERSIGT DIALOG:
------------------------------------------------------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace TidsurClient
{
    /// <summary>
    /// Summary description for Produktionsoversigt.
    /// </summary>
    public class OversigtDialog : System.Windows.Forms.Form
    {
        private System.Windows.Forms.GroupBox groupBox1;
        public  System.Windows.Forms.DataGrid dataGrid1;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.Button button1;
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;

        public OversigtDialog()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if(components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.dataGrid1 = new System.Windows.Forms.DataGrid();
            this.button3 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.button1 = new System.Windows.Forms.Button();
            this.groupBox1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
            this.SuspendLayout();
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.dataGrid1);
            this.groupBox1.Location = new System.Drawing.Point(8, 8);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(736, 272);
            this.groupBox1.TabIndex = 7;
            this.groupBox1.TabStop = false;
            //
            // dataGrid1
            //
            this.dataGrid1.DataMember = "";
            this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
            this.dataGrid1.Location = new System.Drawing.Point(8, 16);
            this.dataGrid1.Name = "dataGrid1";
            this.dataGrid1.Size = new System.Drawing.Size(720, 249);
            this.dataGrid1.TabIndex = 0;
            //
            // button3
            //
            this.button3.Location = new System.Drawing.Point(664, 296);
            this.button3.Name = "button3";
            this.button3.TabIndex = 6;
            this.button3.Text = "Hjælp";
            //
            // button2
            //
            this.button2.Location = new System.Drawing.Point(568, 296);
            this.button2.Name = "button2";
            this.button2.TabIndex = 5;
            this.button2.Text = "Annuller";
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(472, 296);
            this.button1.Name = "button1";
            this.button1.TabIndex = 4;
            this.button1.Text = "OK";
            //
            // Produktionsoversigt
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(752, 333);
            this.Controls.Add(this.groupBox1);
            this.Controls.Add(this.button3);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
            this.Name = "Oversigt";
            this.Text = "Oversigt";
            this.groupBox1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
            this.ResumeLayout(false);

        }
        #endregion
    }
}


TIDSOPERATIONER DIALOG
------------------------------------------------------------------------------------------------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace TidsurClient
{
    /// <summary>
    /// Summary description for TidsursOperationer.
    /// </summary>
    public class TidsursOperationer : System.Windows.Forms.Form
    {
        private System.Windows.Forms.GroupBox groupBox1;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.Button button3;
        public System.Windows.Forms.DataGrid dataGrid;
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;

        public TidsursOperationer()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
        }

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose( bool disposing )
        {
            if( disposing )
            {
                if(components != null)
                {
                    components.Dispose();
                }
            }
            base.Dispose( disposing );
        }

        #region Windows Form Designer generated code
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.groupBox1 = new System.Windows.Forms.GroupBox();
            this.dataGrid = new System.Windows.Forms.DataGrid();
            this.button1 = new System.Windows.Forms.Button();
            this.button2 = new System.Windows.Forms.Button();
            this.button3 = new System.Windows.Forms.Button();
            this.groupBox1.SuspendLayout();
            ((System.ComponentModel.ISupportInitialize)(this.dataGrid)).BeginInit();
            this.SuspendLayout();
            //
            // groupBox1
            //
            this.groupBox1.Controls.Add(this.dataGrid);
            this.groupBox1.Location = new System.Drawing.Point(8, 8);
            this.groupBox1.Name = "groupBox1";
            this.groupBox1.Size = new System.Drawing.Size(376, 208);
            this.groupBox1.TabIndex = 0;
            this.groupBox1.TabStop = false;
            //
            // dataGrid
            //
            this.dataGrid.DataMember = "";
            this.dataGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
            this.dataGrid.Location = new System.Drawing.Point(8, 16);
            this.dataGrid.Name = "dataGrid";
            this.dataGrid.Size = new System.Drawing.Size(360, 184);
            this.dataGrid.TabIndex = 0;           
            //
            // button1
            //
            this.button1.Location = new System.Drawing.Point(312, 232);
            this.button1.Name = "button1";
            this.button1.TabIndex = 1;
            this.button1.Text = "Hjælp";
            //
            // button2
            //
            this.button2.Location = new System.Drawing.Point(216, 232);
            this.button2.Name = "button2";
            this.button2.TabIndex = 2;
            this.button2.Text = "Annuller";
            //
            // button3
            //
            this.button3.Location = new System.Drawing.Point(120, 232);
            this.button3.Name = "button3";
            this.button3.TabIndex = 3;
            this.button3.Text = "OK";
            //
            // TidsursOperationer
            //
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(400, 269);
            this.Controls.Add(this.button3);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.groupBox1);
            this.Name = "TidsursOperationer";
            this.Text = "TidsursOperationer";
            this.groupBox1.ResumeLayout(false);
            ((System.ComponentModel.ISupportInitialize)(this.dataGrid)).EndInit();
            this.ResumeLayout(false);

        }
        #endregion

        private void dataGrid_Navigate(object sender, System.Windows.Forms.NavigateEventArgs ne)
        {
       
        }
    }
}
--------------------------------------------------------------------------------------------------------
Avatar billede odegaard Nybegynder
30. oktober 2003 - 09:33 #1
og hvilken linje får du den fejl i?
Avatar billede ghorfraq Nybegynder
30. oktober 2003 - 09:40 #2
i metoden operationsBeskrivelse
ved linien:
t.dataGrid.SetDataBinding(myDataSet, "TidsursOperationer");
Avatar billede ghorfraq Nybegynder
30. oktober 2003 - 11:09 #3
spørgsmål bliver hermed lukket, har fundet anden og bedre løsning
Avatar billede ghorfraq Nybegynder
30. oktober 2003 - 12:38 #4
g
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
IT-kurser om Microsoft 365, sikkerhed, personlig vækst, udvikling, digital markedsføring, grafisk design, SAP og forretningsanalyse.

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester