Click here to Skip to main content
16,012,468 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to create a style for a combobox in c# Pin
Varsha Ramnani3-Nov-11 21:30
professionalVarsha Ramnani3-Nov-11 21:30 
GeneralRe: How to create a style for a combobox in c# Pin
Arunkumar.Koloth3-Nov-11 23:56
Arunkumar.Koloth3-Nov-11 23:56 
GeneralRe: How to create a style for a combobox in c# Pin
Richard MacCutchan3-Nov-11 23:28
mveRichard MacCutchan3-Nov-11 23:28 
GeneralRe: How to create a style for a combobox in c# Pin
Arunkumar.Koloth3-Nov-11 23:53
Arunkumar.Koloth3-Nov-11 23:53 
GeneralRe: How to create a style for a combobox in c# Pin
V.4-Nov-11 0:31
professionalV.4-Nov-11 0:31 
GeneralRe: How to create a style for a combobox in c# Pin
Subin Mavunkal4-Nov-11 2:36
Subin Mavunkal4-Nov-11 2:36 
GeneralRe: How to create a style for a combobox in c# Pin
V.4-Nov-11 3:07
professionalV.4-Nov-11 3:07 
GeneralRe: How to create a style for a combobox in c# Pin
Arunkumar.Koloth4-Nov-11 5:06
Arunkumar.Koloth4-Nov-11 5:06 
ok guys

Thanks for your replays

Now i am facing another problem

C#
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; //The event handler name must match the event name.
       // private object[] eventObject; //One object[] for each event (one event here).
        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.CreateGraphics();
            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" }; //This is the object that will pass with the event.
            //It must be in that format exactly.
         //   li.SelectedIndexChanged += new EventHandler(SelectedIndexChanged);
//


        }

// private void SelectedIndexChanged(object sender, EventArgs e)
//       {
 //          if (SelectedIndexChanged != null) //You must test this.
 //           {
  //              SelectedIndexChanged(eventObject, null);
  //         }
  //    }





        public void Additems(string[] items)
        {
            li.Items.AddRange(items);
        }

        public bool Enabled
        {
            get { return li.Enabled; }
            set { li.Enabled = value; }
        }
        public bool Visible
        {
            get { return li.Visible; }
            set { li.Visible = value; }
        }


    }
}



Iam Creating a library for combobox.(iam a newbie to c#)

iam using this library for adding many combobox in my form

can any one tell me how to create a selectedindexchanged event handler for each combobox i creating?

i tried the commented code but i got a error like this

Error	1	The type 'Combo.Combo' already contains a definition for 'SelectedIndexChanged'	D:\SelectboxLibrary\SelectboxLibrary\Class1.cs	47	22	SelectboxLibrary


Please Hep me
Cry | :((

Arunkumar
GeneralRe: How to create a style for a combobox in c# Pin
Richard MacCutchan4-Nov-11 0:33
mveRichard MacCutchan4-Nov-11 0:33 
AnswerRe: How to create a style for a combobox in c# Pin
Abhinav S4-Nov-11 1:11
Abhinav S4-Nov-11 1:11 
AnswerRe: How to create a style for a combobox in c# Pin
BillWoodruff4-Nov-11 1:22
professionalBillWoodruff4-Nov-11 1:22 
QuestionCustom Tab Control - Painting Tabs When Scrolling Pin
Matt U.3-Nov-11 6:54
Matt U.3-Nov-11 6:54 
AnswerRe: Custom Tab Control - Painting Tabs When Scrolling Pin
BobJanova4-Nov-11 6:06
BobJanova4-Nov-11 6:06 
QuestionSerial Port Class bug??? Pin
glennPattonWork33-Nov-11 5:47
professionalglennPattonWork33-Nov-11 5:47 
AnswerRe: Serial Port Class bug??? Pin
BobJanova3-Nov-11 6:02
BobJanova3-Nov-11 6:02 
GeneralRe: Serial Port Class bug??? Pin
glennPattonWork33-Nov-11 6:15
professionalglennPattonWork33-Nov-11 6:15 
AnswerRe: Serial Port Class bug??? Pin
Roger Wright3-Nov-11 7:01
professionalRoger Wright3-Nov-11 7:01 
GeneralRe: Serial Port Class bug??? Pin
glennPattonWork33-Nov-11 7:16
professionalglennPattonWork33-Nov-11 7:16 
AnswerRe: Serial Port Class bug??? Pin
Richard MacCutchan3-Nov-11 7:20
mveRichard MacCutchan3-Nov-11 7:20 
GeneralRe: Serial Port Class bug??? Pin
Luc Pattyn3-Nov-11 7:34
sitebuilderLuc Pattyn3-Nov-11 7:34 
GeneralRe: Serial Port Class bug??? Pin
Richard MacCutchan3-Nov-11 23:20
mveRichard MacCutchan3-Nov-11 23:20 
AnswerRe: Serial Port Class bug??? Pin
Luc Pattyn3-Nov-11 7:30
sitebuilderLuc Pattyn3-Nov-11 7:30 
GeneralRe: Serial Port Class bug??? Pin
Roger Wright3-Nov-11 8:43
professionalRoger Wright3-Nov-11 8:43 
AnswerRe: Serial Port Class bug??? Pin
Luc Pattyn3-Nov-11 9:23
sitebuilderLuc Pattyn3-Nov-11 9:23 
GeneralRe: Serial Port Class bug??? Pin
Roger Wright3-Nov-11 10:48
professionalRoger Wright3-Nov-11 10:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.