My problem is that when this executes the results come up as a query in the text box and not the result. Is there a way that this can be converted? The idea is to select a name within the combobox and this should update the 3 textboxes with the corresponding data.

Private Sub ComboBox1_SelectedvalueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedValueChanged
        'when value is changed in combobox update the bount
        Dim current As String = Me.ComboBox1.SelectedText.ToString
        Dim name = From customers In db.Customers Where customers.CustNumber Is current Select customers.CustName
        Dim owing = (From accounts In db.Accounts Where accounts.CustNumber Is current Select accounts.AmountOwing)
        Dim limit = From accounts In db.Accounts Where accounts.CustNumber Is current Select accounts.AccountLimit

        'display the values from query in the textbox
        AccountLimitTextBox.Text = limit.ToString
        AmountOwingTextBox.Text = owing.ToString
        CustNameTextBox.Text = name.ToString


    End Sub

try to use the SingeOrDefault method. like

Dim owing = (From accounts In db.Accounts Where accounts.CustNumber Is current Select accounts.AmountOwing).SingeOrDefault()

Thanks for that. That woeked after I changed the combobox to selected value rather than text.

Cheers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.