Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Error please help

Error please help

Scheduled Pinned Locked Moved C#
helpdatabasegraphics
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Arunkumar Koloth
    wrote on last edited by
    #1

    Hai, Please take a look my code

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Runtime.InteropServices;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;

    namespace Combo
    {

    public class Combo //:IDisposable
    {
        private System.Windows.Forms.ComboBox li = new System.Windows.Forms.ComboBox(); //object
        public event EventHandler SelectedIndexChanged;
        private object\[\] eventObject;
    
        public void Addselect(Control FormName, string name, int top, int left, int width, int height, string Text)
        {
            li.Top = top;
            li.Left = left;
            li.Width = width;
            li.Height = height;
            li.Name = name;
            li.FlatStyle = FlatStyle.Flat;
            li.Text = Text;
            li.IntegralHeight = false;
            li.MaxDropDownItems = 5;
            li.DropDownStyle = ComboBoxStyle.DropDown;
            li.Size = new System.Drawing.Size(136, 81);
            li.BackColor = System.Drawing.Color.DarkGray;
            FormName.Controls.Add(li);
            eventObject = new object\[\] { this, "SelectedIndexChanged" };
            li.SelectedIndexChanged += new EventHandler(li\_SelectedIndexChanged);
        }
    
        private void li\_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (SelectedIndexChanged != null) //You must test this.
            {
                SelectedIndexChanged(eventObject, null);
            }
        }
    
        public bool Enabled
        {
            get { return li.Enabled; }
            set { li.Enabled = value; }
        }
        public bool Visible
        {
            get { return li.Visible; }
            set { li.Visible = value; }
        }
        public void Addtocombobox(string \[\] arguments )
        {
            li.Items.AddRange(arguments);
        }
       ** public int  sindex()
        {
    
            int index;
            index = li.SelectedIndex;
            return index;
            
       }**
    

    }
    }

    The problem is

    public int sindex()
    {

            int index;
            index = li.SelectedIndex;
            return index;
            
       }
    

    when i try to return the selected index of combobox i got error here please hep me to do fix this error This is my error please take a look this

    Error 1 Since 'Combo.Comb

    B 1 Reply Last reply
    0
    • A Arunkumar Koloth

      Hai, Please take a look my code

      using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.Runtime.InteropServices;
      using System.Data;
      using System.Drawing;
      using System.Text;
      using System.Windows.Forms;

      namespace Combo
      {

      public class Combo //:IDisposable
      {
          private System.Windows.Forms.ComboBox li = new System.Windows.Forms.ComboBox(); //object
          public event EventHandler SelectedIndexChanged;
          private object\[\] eventObject;
      
          public void Addselect(Control FormName, string name, int top, int left, int width, int height, string Text)
          {
              li.Top = top;
              li.Left = left;
              li.Width = width;
              li.Height = height;
              li.Name = name;
              li.FlatStyle = FlatStyle.Flat;
              li.Text = Text;
              li.IntegralHeight = false;
              li.MaxDropDownItems = 5;
              li.DropDownStyle = ComboBoxStyle.DropDown;
              li.Size = new System.Drawing.Size(136, 81);
              li.BackColor = System.Drawing.Color.DarkGray;
              FormName.Controls.Add(li);
              eventObject = new object\[\] { this, "SelectedIndexChanged" };
              li.SelectedIndexChanged += new EventHandler(li\_SelectedIndexChanged);
          }
      
          private void li\_SelectedIndexChanged(object sender, EventArgs e)
          {
              if (SelectedIndexChanged != null) //You must test this.
              {
                  SelectedIndexChanged(eventObject, null);
              }
          }
      
          public bool Enabled
          {
              get { return li.Enabled; }
              set { li.Enabled = value; }
          }
          public bool Visible
          {
              get { return li.Visible; }
              set { li.Visible = value; }
          }
          public void Addtocombobox(string \[\] arguments )
          {
              li.Items.AddRange(arguments);
          }
         ** public int  sindex()
          {
      
              int index;
              index = li.SelectedIndex;
              return index;
              
         }**
      

      }
      }

      The problem is

      public int sindex()
      {

              int index;
              index = li.SelectedIndex;
              return index;
              
         }
      

      when i try to return the selected index of combobox i got error here please hep me to do fix this error This is my error please take a look this

      Error 1 Since 'Combo.Comb

      B Offline
      B Offline
      Bernhard Hiller
      wrote on last edited by
      #2

      No, the problem is not in sindex(). It is in F:\SelectboxLibrary\SelectboxLibrary\Class1.cs, line 65. - What's the code there? - How is Combo.Combo linked with that project? I.e. is an older version of Combo.Combo used by Class1 - a version where sindex() is public void sindex()?

      A 1 Reply Last reply
      0
      • B Bernhard Hiller

        No, the problem is not in sindex(). It is in F:\SelectboxLibrary\SelectboxLibrary\Class1.cs, line 65. - What's the code there? - How is Combo.Combo linked with that project? I.e. is an older version of Combo.Combo used by Class1 - a version where sindex() is public void sindex()?

        A Offline
        A Offline
        Arunkumar Koloth
        wrote on last edited by
        #3

        Thankyou for your replay iam trying to create a library of combobox the code shown above is the class1.cs file. of-course there are no other file in my project. Thank you Arunkumar.T

        L 1 Reply Last reply
        0
        • A Arunkumar Koloth

          Thankyou for your replay iam trying to create a library of combobox the code shown above is the class1.cs file. of-course there are no other file in my project. Thank you Arunkumar.T

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Where does this error message come from, compiler or linker? And which compiler are you using?

          Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups