Results 1 to 5 of 5

Thread: [2005] Want to display 2 columns in combobox

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Posts
    83

    Question [2005] Want to display 2 columns in combobox

    Hello all and good morning.

    I was wondering how to make the combobox to display 2 columns, e.g: code and description when the user click to drop down, like in MS Access. the code is stored in table.

    Thanx.

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [2005] Want to display 2 columns in combobox

    This is written in VB.NET. This is written in C# but I think that it may be better. If you Google for multicolumn combobox ".net" you will find others too. Who'd have thought?
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3
    PowerPoster sparrow1's Avatar
    Join Date
    May 2005
    Location
    Globetrotter
    Posts
    2,820

    Re: [2005] Want to display 2 columns in combobox

    Quote Originally Posted by rim78
    Hello all and good morning.

    I was wondering how to make the combobox to display 2 columns, e.g: code and description when the user click to drop down, like in MS Access. the code is stored in table.

    Thanx.
    Hi,

    Here's a link how to create a multicolumn combobox;

    http://www.codeproject.com/vb/net/Mu...nFlatCombo.asp

    Hope it helps,

    sparrow1
    Wkr,
    sparrow1

    If I helped you, don't forget to Rate my post. Thank you

    I'm using Visual Studio.Net 2003 and
    2005
    How to learn VB.Net Create setup with VB 2005 Drawing for beginners VB.Net Tutorials GDI+ Tutorials
    Video's for beginners

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Posts
    83

    Re: [2005] Want to display 2 columns in combobox

    Thank you very much for the links! I'll implement it right away.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Posts
    83

    Question Re: [2005] Want to display 2 columns in combobox

    Finally I got the chance to try out some of your links. Also did search on Google and found a few interesting ones.

    But I'm more into creating a multiple column combobox that supports databinding. Found one here:
    Multi-column combo

    But I'm not sure whether I've implemented it correctly or not. I added a MultiColumn Combo item in Toolbox using the dll file it provided. I also add a MulColCombo reference in the project.

    I dragged the control into my form that is already has a databinding, TestSaveSourceDataSet.

    Now my multicolumn combobox binds to another dataset, Me.StockDataSet.Tables("SOURCETABLE")
    to display 2 columns, SCODE and DESC.

    What I can't seem to workout is how to save the row that I've chosen in the combobox to another, TestSaveSourceDataSet .

    In the multicolumn bombo control, there are a 'Text' property, which, described in the page, "In this property, the selected item will be stores."

    Now, how do I get the combobox to store the SCODE into my TestSaveSource table?

    TIA.


    VB Code:
    1. Private Sub MultipleColmCombo2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.  
    3.         Try
    4.             'Form binds to this dataset
    5.             Me.TestSaveSourceTableAdapter.Fill(Me.TestSaveSource_DataSet.TestSaveSource)
    6.             'Multicolumn combobox binds to this dataset
    7.             Me.SOURCETABLETableAdapter.Fill(Me.StockDataSet.SOURCETABLE)
    8.  
    9.             'Load multicolumn combo
    10.             MultiColumnCombo1.DataSource = Me.StockDataSet.Tables("SOURCETABLE")
    11.             MultiColumnCombo1.LoadData()
    12.  
    13.         Catch ex As Exception
    14.             MessageBox.Show(ex.Message)
    15.         End Try
    16.  
    17.     End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width