Loading 콤보 박스 테이블에서 coulmn 이름 있는 번호

0

질문

나는 테이블의 열 이름을 수만 있습니다. 지금 내가 필요 popuate 하나의 콤보 박스에서는 테이블에 따라 선택 가치의 anothe comcbo 자"라는 cboStandard"그러나 그것은 trigerring 는 오류 "아이고 목록을 위한 필드가 2 만들 수 없습니다". NB:테이블은 열 이름을 결정되는 값에서 선택 cboStandard 콤보 박스 아래에 나의 코드를 채우는 데 콤보자:

**Dim Series As String = (cboStandard.Text).Substring((cboStandard.Text).IndexOf(" ") + 1, 3)
        If Not Series.Contains("Sys") Then
            Dim getWeights As String = "Select [" & Series & "] from StandardChicken where [" & Series & "] > 0 "
            loadcombo(getWeights, cboStandardWeights, Series)
            Dim dt As New DataTable()
            dt = ret.LoadDataTable2(getWeights)
            If Not (dt.Rows.Count = 0) Then
                cboStandardWeights.DataSource = dt
                cboStandardWeights.DisplayMember = Series
                cboStandardWeights.ValueMember = Series
                cboStandardWeights.AutoCompleteSource = AutoCompleteSource.ListItems
                

            ElseIf dt.Rows.Count = 0 Then
                cboStandardWeights.Text = ""
                cboStandardWeights.DataSource = dt
                cboStandardWeights.ValueMember = Series
                cboStandardWeights.DisplayMember = Series
                cboStandardWeights.AutoCompleteSource = AutoCompleteSource.ListItems
            End If**
 
columnname combobox sql vb.net
2021-11-20 09:48:43
1

최고의 응답

0

다음을 수행:

private sub comboBox1_EditvalueChanged(sender As Object, e As EventArgs) Handles comboBox1.EditValueChanged
  dim myValue = CInt(comboBox1.EditValue)
  if myValue = 1 then
    'populate comboBox2
  else if myValue = 2
    'populate comboBox2 with other stuff
  end if
end sub

훨씬 더 쉽습니다. 당신은 당신이 원하는 무엇이든 할 수있는 내부할 수도 있습 숨기를 보여 두 번째 comboBox

2021-11-22 11:32:48

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................