Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Is there now way to add items without setting the datasource of the combobox? i'm very confused by this it would seem to me that there should be a way to comboboxColumn.Items.Add(value,display) but every example i see has datasource=sometable

displaymember= column1Name

valueMemeber = column2Name

 

any help would be appreciated. for now i'll just create a table and bind it since that's the only way i can get it to work.

  • 2 months later...
Posted (edited)

Try this:

 

Create a new winform and add a combobox in designer.

Then go to code and add this:

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

 

namespace quick_test

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

 

private void Form1_Load(object sender, EventArgs e)

{

string example = "This is an example";

 

comboBox1.Items.Add(example);

}

}

}

 

Is this what you mean?

Edited by Pharean
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...