Click here to Skip to main content
16,004,977 members
Home / Discussions / C#
   

C#

 
GeneralRe: How can I get Combobox Selected ValueMember Pin
dataminers24-Jan-07 22:26
dataminers24-Jan-07 22:26 
GeneralRe: How can I get Combobox Selected ValueMember Pin
Martin#24-Jan-07 22:31
Martin#24-Jan-07 22:31 
AnswerRe: How can I get Combobox Selected ValueMember Pin
quiteSmart24-Jan-07 22:29
quiteSmart24-Jan-07 22:29 
GeneralRe: How can I get Combobox Selected ValueMember Pin
dataminers24-Jan-07 22:47
dataminers24-Jan-07 22:47 
GeneralRe: How can I get Combobox Selected ValueMember Pin
dataminers24-Jan-07 22:59
dataminers24-Jan-07 22:59 
GeneralRe: How can I get Combobox Selected ValueMember Pin
{ ZuhaiB }™25-Jan-07 1:57
{ ZuhaiB }™25-Jan-07 1:57 
GeneralRe: How can I get Combobox Selected ValueMember Pin
dataminers25-Jan-07 2:13
dataminers25-Jan-07 2:13 
GeneralRe: How can I get Combobox Selected ValueMember Pin
{ ZuhaiB }™25-Jan-07 2:39
{ ZuhaiB }™25-Jan-07 2:39 
You said you are using DataBase..

See the code bellow this is what I used :

namespace C_TestProject
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent(); ' Contains
}

private void Form1_Load(object sender, EventArgs e)
{
this.dB1TableAdapter.Fill(this.dbTestDataSet.DB1);
}

private void button1_Click(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex >= 0)
MessageBox.Show(comboBox1.SelectedValue.ToString());
}
}
}


// code Inside InitializeComponent()

this.components = new System.ComponentModel.Container();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.button1 = new System.Windows.Forms.Button();
this.dbTestDataSet = new C_TestProject.DbTestDataSet();
this.dB1BindingSource = new System.Windows.Forms.BindingSource(this.components);
this.dB1TableAdapter = new C_TestProject.DbTestDataSetTableAdapters.DB1TableAdapter();
((System.ComponentModel.ISupportInitialize)(this.dbTestDataSet)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dB1BindingSource)).BeginInit();
this.SuspendLayout();
//
// comboBox1
//
this.comboBox1.DataSource = this.dB1BindingSource;
this.comboBox1.DisplayMember = "EmpName";
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(62, 29);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 21);
this.comboBox1.TabIndex = 0;
this.comboBox1.ValueMember = "ID";
//
// button1
//
this.button1.Location = new System.Drawing.Point(62, 90);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(121, 23);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// dbTestDataSet
//
this.dbTestDataSet.DataSetName = "DbTestDataSet";
this.dbTestDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema;
//
// dB1BindingSource
//
this.dB1BindingSource.DataMember = "DB1";
this.dB1BindingSource.DataSource = this.dbTestDataSet;
//
// dB1TableAdapter
//
this.dB1TableAdapter.ClearBeforeFill = true;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(243, 229);
this.Controls.Add(this.button1);
this.Controls.Add(this.comboBox1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.dbTestDataSet)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dB1BindingSource)).EndInit();
this.ResumeLayout(false);
GeneralRe: How can I get Combobox Selected ValueMember Pin
dataminers25-Jan-07 3:46
dataminers25-Jan-07 3:46 
QuestionmessageBox buttons related issue Pin
Saira Tanwir24-Jan-07 22:02
Saira Tanwir24-Jan-07 22:02 
AnswerRe: messageBox buttons related issue Pin
mihksoft24-Jan-07 22:08
mihksoft24-Jan-07 22:08 
AnswerRe: messageBox buttons related issue Pin
Parwej Ahamad24-Jan-07 22:15
professionalParwej Ahamad24-Jan-07 22:15 
GeneralRe: messageBox buttons related issue Pin
Martin#24-Jan-07 22:21
Martin#24-Jan-07 22:21 
AnswerRe: messageBox buttons related issue Pin
quiteSmart24-Jan-07 22:22
quiteSmart24-Jan-07 22:22 
GeneralRe: messageBox buttons related issue Pin
Martin#24-Jan-07 22:27
Martin#24-Jan-07 22:27 
GeneralRe: messageBox buttons related issue Pin
quiteSmart24-Jan-07 22:32
quiteSmart24-Jan-07 22:32 
GeneralRe: messageBox buttons related issue Pin
Martin#24-Jan-07 22:46
Martin#24-Jan-07 22:46 
GeneralRe: messageBox buttons related issue Pin
quiteSmart24-Jan-07 22:50
quiteSmart24-Jan-07 22:50 
GeneralRe: messageBox buttons related issue Pin
Martin#24-Jan-07 23:01
Martin#24-Jan-07 23:01 
GeneralRe: messageBox buttons related issue Pin
Seishin#25-Jan-07 0:33
Seishin#25-Jan-07 0:33 
GeneralRe: messageBox buttons related issue Pin
Stefan Troschuetz24-Jan-07 22:28
Stefan Troschuetz24-Jan-07 22:28 
GeneralRe: messageBox buttons related issue Pin
quiteSmart24-Jan-07 22:31
quiteSmart24-Jan-07 22:31 
GeneralRe: messageBox buttons related issue Pin
Stefan Troschuetz24-Jan-07 22:40
Stefan Troschuetz24-Jan-07 22:40 
GeneralRe: messageBox buttons related issue Pin
quiteSmart24-Jan-07 22:45
quiteSmart24-Jan-07 22:45 
GeneralRe: messageBox buttons related issue Pin
Dan Neely25-Jan-07 2:19
Dan Neely25-Jan-07 2:19 

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.