#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Virginia
    Posts
    19
    Rep Power
    0

    Combo BOX Display Member in VB.NET


    I am problem with populating combo box. Though my combo box is showing correct data that I need but when I run the code I get this exception error message:

    system.ArgumentException: Could not bind the new display member.
    Parameter Name: newDisplayMeber.................


    My Code:

    Dim oraCntrDS As DataSet
    oraCntrDS = New DataSet("CntrID")
    oraCntrAdapter.Fill(oraCntrDS)

    cmbCntrId.DataSource = oraCntrDS.Tables("Center")
    cmbCntrId.ValueMember = "Center_ID"
    cmbCntrId.DisplayMember = "Center_ID"


    The error is generated at

    cmbCntrId.ValueMember = "Center_ID"

    Since I have error handling code, it does not break my application.

    I would appreciate your help.

    Thanks
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    10
    Rep Power
    0
    sometimes the order of the display member and value member matters. Also make sure that the column names are correct. Column names in oracle are case sensitive.

    try this:

    Dim oraCntrDS As DataSet
    oraCntrDS = New DataSet("CntrID")
    oraCntrAdapter.Fill(oraCntrDS)

    cmbCntrId.DisplayMember = "Center_ID"
    cmbCntrId.ValueMember = "Center_ID"
    cmbCntrId.DataSource = oraCntrDS.Tables("Center")
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Location
    Virginia
    Posts
    19
    Rep Power
    0

    Thank You


    Hi harshil_p,

    Thanks for your prompt reply. You were right, it was the Case - Sensitive issue. I got it right, its working fine now.

    Though I could not understand that why was it working initially with error. And once I took care of the case sensitive, its working without any errors.

    Anyhow, thanks again.
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2012
    Posts
    1
    Rep Power
    0

    For me the code did not work


    Originally Posted by vinidel
    Hi harshil_p,

    Thanks for your prompt reply. You were right, it was the Case - Sensitive issue. I got it right, its working fine now.

    Though I could not understand that why was it working initially with error. And once I took care of the case sensitive, its working without any errors.

    Anyhow, thanks again.
    Here is My code

    Private Sub Driver_Information_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source= C:\Penalty Point System\Penalty point1.mdb"

    sql1 = "Select Driver.[Licence No] From Driver "
    Dim da As New OleDb.OleDbDataAdapter(sql1, con)

    sql2 = "SELECT COUNT(*) FROM Driver"
    Dim oraCntrDS As DataSet
    oraCntrDS = New DataSet("CntrID")
    con.Open()
    da.Fill(oraCntrDS)
    con.Close()
    ComboBox1.DisplayMember = "Licence Number"
    ComboBox1.ValueMember = "Licence Number"
    ComboBox1.DataSource = oraCntrDS.Tables("Center")
    Can some one tell me whats wrong with my code
    Thank you

IMN logo majestic logo threadwatch logo seochat tools logo