Click here to Skip to main content
15,891,136 members
Home / Discussions / C#
   

C#

 
AnswerRe: System.Net.Mail setup Pin
PauloCastilho4-Mar-09 9:20
PauloCastilho4-Mar-09 9:20 
AnswerRe: System.Net.Mail setup Pin
Yusuf4-Mar-09 9:23
Yusuf4-Mar-09 9:23 
GeneralRe: System.Net.Mail setup Pin
dptalt4-Mar-09 10:01
dptalt4-Mar-09 10:01 
GeneralRe: System.Net.Mail setup Pin
Yusuf4-Mar-09 10:14
Yusuf4-Mar-09 10:14 
AnswerRe: System.Net.Mail setup Pin
Dave Kreskowiak4-Mar-09 9:51
mveDave Kreskowiak4-Mar-09 9:51 
QuestionPopulating combobox with values from Table using C# Pin
haroon19804-Mar-09 8:05
haroon19804-Mar-09 8:05 
AnswerRe: Populating combobox with values from Table using C# [modified] Pin
Jimmanuel4-Mar-09 8:41
Jimmanuel4-Mar-09 8:41 
GeneralRe: Populating combobox with values from Table using C# Pin
haroon19804-Mar-09 9:18
haroon19804-Mar-09 9:18 
Hi Jimmanuel,
...What else method or way u recommend instead of SelectedIndexChanged ? can u pls gimme example?
... I have 3 fields in that table so why it is inefficient?



i have changed code and following is here: to include dr.close method..
 private void comboBox3_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {

                database = new OleDbConnection(connectionString);

                // Create a command object and then a query which accepts a papameter
                System.Data.OleDb.OleDbCommand cmd = new System.Data.OleDb.OleDbCommand("Select distinct ProductName from Products", database);
                database.Open();
                System.Data.OleDb.OleDbDataReader dr;
                dr = cmd.ExecuteReader();

                while (dr.Read())
                {
                    //comboBox3.Items.AddRange(new object[] { dr[1].ToString() });  //Change the index according to the values you want to populate in the combobox.
                    comboBox3.Items.AddRange(new Object[] { dr[1].ToString() });
                    
                }
                dr.Close();
            }
            catch (Exception ex)
            {

                MessageBox.Show(ex.Message);
                return;
            }
}


please help
GeneralRe: Populating combobox with values from Table using C# Pin
Jimmanuel4-Mar-09 9:44
Jimmanuel4-Mar-09 9:44 
AnswerRe: Populating combobox with values from Table using C# Pin
Yusuf4-Mar-09 9:26
Yusuf4-Mar-09 9:26 
GeneralRe: Populating combobox with values from Table using C# Pin
haroon19804-Mar-09 10:54
haroon19804-Mar-09 10:54 
QuestionC# Referencing Cell on DataGrid Pin
Wheels0124-Mar-09 6:06
Wheels0124-Mar-09 6:06 
AnswerRe: C# Referencing Cell on DataGrid Pin
dan!sh 4-Mar-09 6:08
professional dan!sh 4-Mar-09 6:08 
GeneralRe: C# Referencing Cell on DataGrid Pin
Wheels0124-Mar-09 6:40
Wheels0124-Mar-09 6:40 
GeneralRe: C# Referencing Cell on DataGrid Pin
led mike4-Mar-09 7:13
led mike4-Mar-09 7:13 
GeneralRe: C# Referencing Cell on DataGrid Pin
Wheels0124-Mar-09 7:19
Wheels0124-Mar-09 7:19 
GeneralRe: C# Referencing Cell on DataGrid Pin
Samuel Cherinet4-Mar-09 19:54
Samuel Cherinet4-Mar-09 19:54 
GeneralRe: C# Referencing Cell on DataGrid Pin
Wheels0125-Mar-09 1:22
Wheels0125-Mar-09 1:22 
Questionicons in buttons with flatstyle.System Pin
mirko864-Mar-09 5:43
mirko864-Mar-09 5:43 
AnswerRe: icons in buttons with flatstyle.System Pin
Xmen Real 4-Mar-09 6:05
professional Xmen Real 4-Mar-09 6:05 
QuestionComboBox in DataGridview Pin
rafaelht31084-Mar-09 4:31
rafaelht31084-Mar-09 4:31 
AnswerRe: ComboBox in DataGridview Pin
Xmen Real 4-Mar-09 4:54
professional Xmen Real 4-Mar-09 4:54 
GeneralRe: ComboBox in DataGridview Pin
rafaelht31084-Mar-09 5:07
rafaelht31084-Mar-09 5:07 
Questionwater marking Pin
rohan40404-Mar-09 4:25
rohan40404-Mar-09 4:25 
AnswerRe: water marking Pin
Xmen Real 4-Mar-09 4:35
professional Xmen Real 4-Mar-09 4:35 

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.