Click here to Skip to main content
15,914,160 members
Home / Discussions / C#
   

C#

 
GeneralRe: Pound sign in XML Pin
Reiss7-Nov-11 4:47
professionalReiss7-Nov-11 4:47 
GeneralRe: Pound sign in XML Pin
RugbyLeague7-Nov-11 4:48
RugbyLeague7-Nov-11 4:48 
GeneralRe: Pound sign in XML Pin
RugbyLeague7-Nov-11 4:58
RugbyLeague7-Nov-11 4:58 
GeneralRe: Pound sign in XML Pin
BobJanova7-Nov-11 5:22
BobJanova7-Nov-11 5:22 
GeneralRe: Pound sign in XML Pin
RugbyLeague7-Nov-11 6:03
RugbyLeague7-Nov-11 6:03 
AnswerRe: Pound sign in XML Pin
BobJanova7-Nov-11 4:42
BobJanova7-Nov-11 4:42 
AnswerRe: Pound sign in XML Pin
Ennis Ray Lynch, Jr.7-Nov-11 6:58
Ennis Ray Lynch, Jr.7-Nov-11 6:58 
QuestionError please help Pin
Arunkumar.Koloth6-Nov-11 22:08
Arunkumar.Koloth6-Nov-11 22:08 
Hai,

Please take a look my code
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;
        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

C#
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.Combo.sindex()' returns void, a return keyword must not be followed by an object expression	F:\SelectboxLibrary\SelectboxLibrary\Class1.cs	65	13	SelectboxLibrary

i dont know what is the error

Anyone Please help me?
Arunkumar.T
AnswerRe: Error please help Pin
Bernhard Hiller6-Nov-11 22:34
Bernhard Hiller6-Nov-11 22:34 
GeneralRe: Error please help Pin
Arunkumar.Koloth6-Nov-11 23:25
Arunkumar.Koloth6-Nov-11 23:25 
GeneralRe: Error please help Pin
Richard MacCutchan7-Nov-11 4:03
mveRichard MacCutchan7-Nov-11 4:03 
QuestionShamos Pin
msafary6-Nov-11 21:54
msafary6-Nov-11 21:54 
AnswerRe: Shamos Pin
Richard MacCutchan6-Nov-11 22:46
mveRichard MacCutchan6-Nov-11 22:46 
Question"economics" of casting to an interface in a parameter declaration of a method ? Pin
BillWoodruff6-Nov-11 20:41
professionalBillWoodruff6-Nov-11 20:41 
AnswerRe: "economics" of casting to an interface in a parameter declaration of a method ? Pin
harold aptroot6-Nov-11 21:37
harold aptroot6-Nov-11 21:37 
AnswerRe: "economics" of casting to an interface in a parameter declaration of a method ? Pin
Luc Pattyn6-Nov-11 22:56
sitebuilderLuc Pattyn6-Nov-11 22:56 
AnswerRe: "economics" of casting to an interface in a parameter declaration of a method ? Pin
PIEBALDconsult7-Nov-11 1:49
mvePIEBALDconsult7-Nov-11 1:49 
AnswerRe: "economics" of casting to an interface in a parameter declaration of a method ? Pin
DaveyM697-Nov-11 11:11
professionalDaveyM697-Nov-11 11:11 
GeneralRe: "economics" of casting to an interface in a parameter declaration of a method ? Pin
BillWoodruff7-Nov-11 19:03
professionalBillWoodruff7-Nov-11 19:03 
GeneralRe: "economics" of casting to an interface in a parameter declaration of a method ? Pin
DaveyM697-Nov-11 21:36
professionalDaveyM697-Nov-11 21:36 
GeneralRe: "economics" of casting to an interface in a parameter declaration of a method ? Pin
Pete O'Hanlon7-Nov-11 23:19
mvePete O'Hanlon7-Nov-11 23:19 
GeneralRe: "economics" of casting to an interface in a parameter declaration of a method ? Pin
DaveyM698-Nov-11 6:45
professionalDaveyM698-Nov-11 6:45 
GeneralRe: "economics" of casting to an interface in a parameter declaration of a method ? Pin
BobJanova8-Nov-11 0:14
BobJanova8-Nov-11 0:14 
GeneralRe: "economics" of casting to an interface in a parameter declaration of a method ? Pin
DaveyM698-Nov-11 6:57
professionalDaveyM698-Nov-11 6:57 
AnswerNot so simple (Re: "economics" of casting to an interface in a parameter declaration of a method?) Pin
Sergey Alexandrovich Kryukov8-Nov-11 14:58
mvaSergey Alexandrovich Kryukov8-Nov-11 14:58 

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.