DisplayMember error on combobox in vb.net 2005
Posted on 2007-08-01
I currently have quote a large project for my first really program writen in vb.net and am finding there are a lot of things I need to know to accomplish this so I would apprecitate your help as a novice.
I have the following code: -
Private Sub frmAddProduct_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
On Error GoTo error_Handler
Dim ds As New DataSet
sql = "SET NOCOUNT ON; SELECT TestRigID,SSDNumber, Description,CalibrationDue,bUserLock,DocNum,JobReference,RoutingStage,bPCBTester,bDriveTester, bObsolete, PartIdentity FROM Admin_SSDNumber WHERE bLogicalDelete=0 ORDER BY SSDNumber;"
Dim da As New SqlClient.SqlDataAdapter(sql, oConn)
da.Fill(ds, "Rigs") ' populate data set "da" with the data returned from sql command "ds" and set dataset name to "Rigs"
DataGridView1.DataSource = ds.Tables("Rigs")
cmbRigs.DisplayMember = ("SSDNumber" & "-" & "Description")
cmbRigs.ValueMember = "Description"
cmbRigs.DataSource = ds.Tables("Rigs")
If Err.Number <> 0 Then
MsgBox("An error has occured while connecting to the SQL Server. Error no: " & Err.Number & vbCrLf & vbCrLf & "Description:" & vbCrLf & Err.Description)
Where I set the cmbRigs.DisplayMember = ("SSDNumber" & "-" & "Description") it only shows System.Data.DataRowView as the data in the combobox. IT was originally SSDNumber and it worked correctly but I need it to show the SSDNumber and then the Description at the side on the same line of the combobox.
Is this at all possible?