[AccessD] OT Visual basic Express 2012 - ComboBox

Bill Benson bensonforums at gmail.com
Thu Feb 12 08:28:07 CST 2015


Paul, why not just set the bound columnwidths property such that the column
you want has a width of 0? That is what I normally do if I take your
meaning.

On Thu, Feb 12, 2015 at 3:01 AM, Paul Hartland <paul.hartland at googlemail.com
> wrote:

> To all,
>
> I have only really developed in MS Access and Visual Basic 6.0....I am on a
> learning curve at work where we have Visual Studio Express 2012 installed
> on my machine. I have the following code to populate a combobox :
>
> Dim adtRequestCodes As New SqlDataAdapter()
> Dim dsRequestCodes As New DataSet()
> Try
>             Dim cmdPIPRequestCodes As New SqlCommand()
>             cmdPIPRequestCodes.Connection = pADOPIPConn
>             cmdPIPRequestCodes.CommandText = "phPIP_RequestCodes"
>             cmdPIPRequestCodes.CommandType = CommandType.StoredProcedure
>             adtRequestCodes.SelectCommand = cmdPIPRequestCodes
>             adtRequestCodes.Fill(dsRequestCodes)
>             adtRequestCodes.Dispose()
>             cmdPIPRequestCodes.Dispose()
>             Me.cmbRequestCodes.DataSource = dsRequestCodes.Tables(0)
>             Me.cmbRequestCodes.ValueMember = "ReasonID"
>             Me.cmbRequestCodes.DisplayMember = "ReasonCode"
> Catch ex As Exception
>             MsgBox(ex.Message)
> End Try
>
> This works as it populates the ComboBox.  However I have datatable called
> tblPIPRequests which I use to populate textboxes with data using something
> like '
>
> Me.txtResolvedBy.DataBindings.Add("Text", tblPIPRequests, "ResolvedByName")
> '.  But can't figure out how to have the combobox show the value of
> RequestCode from the datatable
>
> I.e. in the datatable 'tblPIPRequests' say the 'RequestCode' is 4 I need
> the combobox to show the 'ReasonCode' associated with RequestCode 4 which
> would be 'Incorrect Desription'
>
>
> It may even be that I have set this all up wrong for what I need, I have
> been googling here and there just to get where I am now.
>
> Any help GREATLY appreciated.
>
> --
> Paul Hartland
> paul.hartland at googlemail.com
> --
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com
>


More information about the AccessD mailing list