Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

multiple values in previous comboboxes VB.net

$
0
0
Hi All,

On my form, I have few comboboxes, which are taking data from access table.
Name:  Combo.jpg
Views: 51
Size:  43.3 KB

The form works like that -

On-Load connection.Open()

after that, user is oblige to choose

1) Account, if he will choose value from combobox, Tower combobox will be enabled (true)

2) Tower, if he will choose value from combobox, Process combobox will be enabled (true)

3) Process, if he will choose value from combobox, User combobox will be enabled (true)

4) rest of comboboxes will be enabled after choosing User. (Those are depends on the user and earlier comboboxes)

My problem is, that Combobox is taking data from table in Access, each has it's own table, because we are uploading data from other form, and our processes are sufisticated, and after choosing first, second, thirds etc. - everything is okay, when employees are choosing it correctly, but if he will choose wrong value, and he would like to change it in previous combobox, the values in it are:

Name:  Comboissue.jpg
Views: 40
Size:  45.1 KB

There are only multiple items, and I cannot clear previous items and start once again....

The code for User combobox (as an example). I'm calling it from Form_Load.

Code:

    Sub fillUser()
        Dim var As String = cbAccount.SelectedItem
        Dim var2 As String = cbTower.SelectedItem
        Dim var3 As String = cbProcess.SelectedItem
        strsql = "Select Distinct * from TimerUser where((TimerAccount like '%" + var + "%') AND (TimerTower like '%" + var2 + "%') and (TimerProcess like '%" + var3 + "%'))"
        Dim acscmd As New OleDb.OleDbCommand
        acscmd.CommandText = strsql
        acscmd.Connection = cn
        acsdr = acscmd.ExecuteReader
        While (acsdr.Read())
            Me.cbUser.Items.Add(acsdr("UserT"))

        End While
        acscmd.Dispose()
        acsdr.Close()
    End Sub

Thank you for your help in advance!

Matt
Attached Images
  

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>