How would I define "GetDataFromNumber" so that my class contains a definition?

Posted by JB on Stack Overflow See other posts from Stack Overflow or by JB
Published on 2010-04-28T03:21:51Z Indexed on 2010/04/28 3:33 UTC
Read the original article Hit count: 269

Filed under:
|

My code gets an error saying:

'Eagle_Eye_Class_Finder.GetSchedule' does not contain a definition for 'GetDataFromNumber' and no extension method 'GetDataFromNumber'.

using System;
using System.IO;
using System.Data;
using System.Text;
using System.Drawing;
using System.Data.OleDb;
using System.Collections;
using System.Windows.Forms;
using System.ComponentModel;
using System.Drawing.Printing;
using System.Collections.Generic;

namespace Eagle_Eye_Class_Finder
{

    /// This form is the entry form, it is the first form the user will see when the app is run.
    /// 

    public class Form1 : System.Windows.Forms.Form
    {
        private System.Windows.Forms.TextBox textBox1;
        private System.Windows.Forms.ProgressBar progressBar1;
        private System.Windows.Forms.PictureBox pictureBox1;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.DateTimePicker dateTimePicker1;
        private IContainer components;
        private Timer timer1;
        private BindingSource form1BindingSource;
        public static Form Mainform = null;

        // creates new instance of second form
        YOURCLASSSCHEDULE SecondForm = new YOURCLASSSCHEDULE();

        public Form1()
        {
            InitializeComponent();

            // TODO: Add any constructor code after InitializeComponent call

        }

        /// Clean up any resources being used.

        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.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.progressBar1 = new System.Windows.Forms.ProgressBar();
            this.pictureBox1 = new System.Windows.Forms.PictureBox();
            this.button2 = new System.Windows.Forms.Button();
            this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
            this.timer1 = new System.Windows.Forms.Timer(this.components);
            this.form1BindingSource = new System.Windows.Forms.BindingSource(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.form1BindingSource)).BeginInit();
            this.SuspendLayout();
            // 
            // textBox1
            // 
            this.textBox1.BackColor = System.Drawing.SystemColors.ActiveCaption;
            this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.form1BindingSource, "Text", true, System.Windows.Forms.DataSourceUpdateMode.OnValidation, null, "900456317"));
            this.textBox1.Location = new System.Drawing.Point(328, 280);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(208, 20);
            this.textBox1.TabIndex = 2;
            this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
            // 
            // progressBar1
            // 
            this.progressBar1.Location = new System.Drawing.Point(258, 410);
            this.progressBar1.MarqueeAnimationSpeed = 10;
            this.progressBar1.Name = "progressBar1";
            this.progressBar1.Size = new System.Drawing.Size(344, 8);
            this.progressBar1.TabIndex = 3;
            this.progressBar1.Click += new System.EventHandler(this.progressBar1_Click);
            // 
            // pictureBox1
            // 
            this.pictureBox1.BackColor = System.Drawing.SystemColors.ControlLightLight;
            this.pictureBox1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
            this.pictureBox1.Location = new System.Drawing.Point(680, 400);
            this.pictureBox1.Name = "pictureBox1";
            this.pictureBox1.Size = new System.Drawing.Size(120, 112);
            this.pictureBox1.TabIndex = 4;
            this.pictureBox1.TabStop = false;
            this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
            // 
            // button2
            // 
            this.button2.Font = new System.Drawing.Font("Mistral", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.button2.Image = ((System.Drawing.Image)(resources.GetObject("button2.Image")));
            this.button2.Location = new System.Drawing.Point(699, 442);
            this.button2.Name = "button2";
            this.button2.Size = new System.Drawing.Size(78, 28);
            this.button2.TabIndex = 5;
            this.button2.Text = "OK";
            this.button2.Click += new System.EventHandler(this.button2_Click);
            // 
            // dateTimePicker1
            // 
            this.dateTimePicker1.Location = new System.Drawing.Point(336, 104);
            this.dateTimePicker1.Name = "dateTimePicker1";
            this.dateTimePicker1.Size = new System.Drawing.Size(200, 20);
            this.dateTimePicker1.TabIndex = 6;
            this.dateTimePicker1.ValueChanged += new System.EventHandler(this.dateTimePicker1_ValueChanged);
            // 
            // timer1
            // 
            this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
            // 
            // form1BindingSource
            // 
            this.form1BindingSource.DataSource = typeof(Eagle_Eye_Class_Finder.Form1);
            // 
            // Form1
            // 
            this.AcceptButton = this.button2;
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
            this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
            this.ClientSize = new System.Drawing.Size(856, 556);
            this.Controls.Add(this.dateTimePicker1);
            this.Controls.Add(this.button2);
            this.Controls.Add(this.pictureBox1);
            this.Controls.Add(this.progressBar1);
            this.Controls.Add(this.textBox1);
            this.Name = "Form1";
            this.Text = "Eagle Eye Class Finder";
            this.Load += new System.EventHandler(this.Form1_Load);
            ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.form1BindingSource)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }
        #endregion

        /// The main entry point for the application.

        [STAThread]
        static void Main()
        {
            Application.Run(new Form1());

        }

        public void Form1_Load(object sender, System.EventArgs e)
        {


        }

        public void textBox1_TextChanged(object sender, System.EventArgs e)
        {
            //allows only numbers to be entered in textbox
            string Str = textBox1.Text.Trim();
            double Num;
            bool isNum = double.TryParse(Str, out Num);

            if (isNum)

                Console.ReadLine();

            else
                MessageBox.Show("Enter A Valid ID Number!");                              

        }

        public void button2_Click(object sender, System.EventArgs e)
        {
            string text = textBox1.Text;
            Mainform = this;

            this.Hide();

            GetSchedule myScheduleFinder = new GetSchedule();
            string result = myScheduleFinder.GetDataFromNumber(text);<<<-----MY PROBLEM

            if (!string.IsNullOrEmpty(result))
            {
                MessageBox.Show(result);
            }
            else
            {
                MessageBox.Show("Enter A Valid ID Number!");
            }
        }


        public void dateTimePicker1_ValueChanged(object sender, System.EventArgs e)
        {

        }

        public void pictureBox1_Click(object sender, System.EventArgs e)
        {

        }

        public void progressBar1_Click(object sender, EventArgs e)
        {
            //this.progressBar1 = new System.progressBar1();
            //progressBar1.Maximum = 200;
            //progressBar1.Minimum = 0;
            //progressBar1.Step = 20;

        }

        private void timer1_Tick(object sender, EventArgs e)
        {
            //if (progressBar1.Value >= 200 )
            //{
            //progressBar1.Value = 0;
            //}
            //return;
            //}

            //progressBar1.Value != 20;

        }

        }

    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about winforms